allow overriding argv and progname

this will be used by the comming 'ryu' command.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
YAMAMOTO Takashi 2014-03-26 15:20:06 +09:00 committed by FUJITA Tomonori
parent 186da7eb78
commit e88529f966
3 changed files with 10 additions and 7 deletions

View File

@ -52,12 +52,14 @@ CONF.register_cli_opts([
])
def main():
def main(args=None, prog=None):
try:
CONF(project='ryu', version='ryu-manager %s' % version,
CONF(args=args, prog=prog,
project='ryu', version='ryu-manager %s' % version,
default_config_files=['/usr/local/etc/ryu/ryu.conf'])
except cfg.ConfigFilesNotFoundError:
CONF(project='ryu', version='ryu-manager %s' % version)
CONF(args=args, prog=prog,
project='ryu', version='ryu-manager %s' % version)
log.init_log()

View File

@ -545,8 +545,9 @@ lost-connection-behavior failStandaloneMode
self._in_onecmd = False
def main():
CONF(project='of-config-cli', version='of-config-cli')
def main(args=None, prog=None):
CONF(args=args, prog=prog,
project='of-config-cli', version='of-config-cli')
for p_str in CONF.peers:
name, addr = p_str.split('=')

View File

@ -222,8 +222,8 @@ class Cmd(cmd.Cmd):
signal.alarm(self._notification_check_interval)
def main():
CONF(project='rpc-cli', version='rpc-cli')
def main(args=None, prog=None):
CONF(args=args, prog=prog, project='rpc-cli', version='rpc-cli')
for p_str in CONF.peers:
name, addr = p_str.split('=')