From 6be8ef390687376eec1464a7ea451a2912cb7f44 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 12 Feb 2013 17:20:57 +0900 Subject: 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 Signed-off-by: FUJITA Tomonori --- bin/ryu-manager | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'bin') 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) -- cgit v1.2.3