diff options
author | YAMAMOTO Takashi <yamamoto@valinux.co.jp> | 2013-02-12 17:20:57 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2013-02-14 12:34:08 +0900 |
commit | 6be8ef390687376eec1464a7ea451a2912cb7f44 (patch) | |
tree | 1405cf06952e1f278873874e57e5851551a99245 /bin | |
parent | 6dcfed271e9cca14233ec58535bbf9fbe3457432 (diff) |
use openstack.common.cfg instead of gflags
make most of modules use openstack.common.cfg instead of gflags
caveats: no config file compatibility is provided. (flagfile vs ini file)
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ryu-manager | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/bin/ryu-manager b/bin/ryu-manager index fca93291..d53906b1 100755 --- a/bin/ryu-manager +++ b/bin/ryu-manager @@ -20,7 +20,7 @@ import gevent from gevent import monkey monkey.patch_all() -import gflags +from openstack.common import cfg import logging import sys @@ -29,7 +29,6 @@ log.early_init_log(logging.DEBUG) from ryu import flags from ryu import version -from ryu import utils from ryu.app import wsgi from ryu.base.app_manager import AppManager from ryu.controller import controller @@ -41,31 +40,26 @@ from ryu.controller import controller import ryu.contrib -FLAGS = gflags.FLAGS -gflags.DEFINE_bool('version', False, 'output version information and exit') -gflags.DEFINE_multistring('app_lists', - [], - 'application module name to run') +CONF = cfg.CONF +CONF.register_cli_opts([ + cfg.ListOpt('app_lists', default=[], + help='application module name to run'), + cfg.MultiStrOpt('app', positional=True, default=[], + help='application module name to run') +]) def main(): - utils.find_flagfile() - args = FLAGS(sys.argv) - - if FLAGS.version: - print 'ryu-manager %s' % version - sys.exit(0) + CONF(project='ryu', version='ryu-manager %s' % version) log.init_log() # always enable ofp for now. - FLAGS.app_lists += ['ryu.controller.ofp_handler'] - - if len(args) > 1: - FLAGS.app_lists += args[1:] + CONF.app_lists += ['ryu.controller.ofp_handler'] + CONF.app_lists += CONF.app app_mgr = AppManager() - app_mgr.load_apps(FLAGS.app_lists) + app_mgr.load_apps(CONF.app_lists) contexts = app_mgr.create_contexts() app_mgr.instantiate_apps(**contexts) |