The flags.py is the centralized place to handle options.
Register all cli options in flags.py. Later startup routine import flags.py
to register cli options.

Signed-off-by: Isaku Yamahata <yamah...@valinux.co.jp>
---
 ryu/flags.py |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/ryu/flags.py b/ryu/flags.py
index 533f7de..110fb54 100644
--- a/ryu/flags.py
+++ b/ryu/flags.py
@@ -1,5 +1,5 @@
-# Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.
-# Copyright (C) 2011 Isaku Yamahata <yamahata at valinux co jp>
+# Copyright (C) 2011, 2013 Nippon Telegraph and Telephone Corporation.
+# Copyright (C) 2011, 2013 Isaku Yamahata <yamahata at valinux co jp>
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,8 +19,25 @@ global flags
 
 from oslo.config import cfg
 
+
+# module does CONF.register_cli_options() on load
+def _register_cli_options(module_name):
+    try:
+        __import__(module_name)
+    except ImportError:
+        pass
+
+
+_register_cli_options('ryu.app.wsgi')
+_register_cli_options('ryu.log')
+_register_cli_options('ryu.topology.switches')
+# Add modules that call CONF.register_cli_options()
+
+
+# global options
 CONF = cfg.CONF
 
+
 CONF.register_cli_opts([
     # app/quantum_adapter
     cfg.StrOpt('quantum-url', default='http://localhost:9696',
-- 
1.7.10.4


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to