This might be necessary for future vesions of Neutron OVS agent.

1. The agent parses options, including command line options, using
  oslo.config.cfg.CONF ConfigOpt instance.
2. Depending on options, it might lazily import ryu modules.
3. The ryu modules might have import-time register_cli_opts calls
  against ryu.cfg.CONF.
3. As ryu.cfg.CONF is same as oslo.config.cfg.CONF, oslo.config
  raises an exception, complaining register_cli_opts is used after
  parsing command line options.

Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 ryu/cfg.py | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/ryu/cfg.py b/ryu/cfg.py
index ea21ea4..ae1d817 100644
--- a/ryu/cfg.py
+++ b/ryu/cfg.py
@@ -22,17 +22,15 @@ import oslo.config.cfg
 #    b. RyuApp.CONF  (preferred way for ryu applications)
 #    c. oslo.config.cfg.CONF
 #
-# Currently all of above shares a single ConfigOpts instance.
-# We will unshare c. (and stop using it) as soon as ofagent neutron agent
-# is updated.
-# We want to avoid using c. for our options as a python program which embeds
-# ryu applications (eg. neutron agent) might want to put its own set of cli
-# options into it, which can conflict with ours.  (Currently there seems
-# no conflict for the neutron agent.  But who knows?)
+# Currently a. and b. shares a single ConfigOpts instance.
+# We intentionally avoid using c. for our options as a python program
+# which embeds ryu applications (eg. neutron agent) might want to put
+# its own set of cli options into it, which can conflict with ours.
+# (Currently there seems no conflict for the neutron agent.  But who knows?)
 # At some point later we might want to unshare a. and b. as well, in order
 # to allow app-specific options.
 
-CONF = oslo.config.cfg.CONF
+CONF = oslo.config.cfg.ConfigOpts()
 
 # re-export for convenience
 
-- 
2.1.0


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to