Thanks much Wei-Li.
I will try this today.
--Tom
On 5/27/2014 10:18 PM, Wei-Li Tang wrote:
Hello Tom,
CLI option should be registered before CONF being initialized in
cmd/manager.py. You can simply import your app in cmd/manager.py in
advance as below:
diff --git a/ryu/cmd/manager.py b/ryu/cmd/manager.py
index 4710547..a9d5101 100755
--- a/ryu/cmd/manager.py
+++ b/ryu/cmd/manager.py
@@ -41,6 +41,7 @@ from ryu.app import wsgi
from ryu.base.app_manager import AppManager
from ryu.controller import controller
from ryu.topology import switches
+from ryu.app import myapp
CONF = cfg.CONF
2014-05-28 7:59 GMT+08:00 Thomas F Herbert <thomasfherb...@gmail.com
<mailto:thomasfherb...@gmail.com>>:
Ryu experts,
I have a question,
I am writing a ryu app. Is there a way to add command line
configuration
arguments when writing an app?
I tried the following also used in wsgi.py app but it didn't work.
from ryu import cfg
CONF = cfg.CONF
CONF.register_cli_opts([
cfg.StrOpt('policy', default='block', help = 'Policy: One of
A, B,
C, C'),
cfg.StrOpt('NetworkMask', default='192.168.1.1/24
<http://192.168.1.1/24>', help = 'Network
Gateway and netmask '),
])
...
I got this error from oslo.
t@Ryu:~/ryu$ PYTHONPATH=. ./bin/ryu-manager ryu/app/myapp.py
loading app ryu/app/myapp.py
Traceback (most recent call last):
File "./bin/ryu-manager", line 19, in <module>
main()
File "/home/therbert/ryu/ryu/cmd/manager.py", line 72, in main
app_mgr.load_apps(app_lists)
File "/home/therbert/ryu/ryu/base/app_manager.py", line 340, in
load_apps
cls = self.load_app(app_cls_name)
File "/home/therbert/ryu/ryu/base/app_manager.py", line 324, in
load_app
mod = utils.import_module(name)
File "/home/therbert/ryu/ryu/utils.py", line 86, in import_module
__import__(name)
File "/home/therbert/ryu/ryu/app/mordred.py", line 51, in <module>
cfg.StrOpt('NetworkMask', default='192.168.1.1/24
<http://192.168.1.1/24>', help = 'Network
Gateway and netmask '),
File "/usr/local/lib/python2.7/dist-packages/oslo/config/cfg.py",
line 1547, in __inner
result = f(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/oslo/config/cfg.py",
line 1711, in register_cli_opts
self.register_cli_opt(opt, group, clear_cache=False)
File "/usr/local/lib/python2.7/dist-packages/oslo/config/cfg.py",
line 1551, in __inner
return f(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/oslo/config/cfg.py",
line 1703, in register_cli_opt
raise ArgsAlreadyParsedError("cannot register CLI option")
oslo.config.cfg.ArgsAlreadyParsedError: arguments already parsed:
cannot
register CLI option
Thanks in advance,
--Tom
------------------------------------------------------------------------------
The best possible search technologies are now affordable for all
companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no
commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
<mailto:Ryu-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/ryu-devel
--
Sincerely,
Wei-Li Tang
System Engineer, Xinguard Inc.
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel