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', 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', 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
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to