def setUp(self): super(BaseTestCase, self).setUp() #NOTE(bcwaldon): parse_args has to be called to register certain # command-line options - specifically we need config_dir for # the following policy tests config.parse_args()
def main(): try: config.parse_args() wsgi.set_eventlet_hub() logging.setup(CONF, 'umbrella') #if cfg.CONF.profiler.enabled: # _notifier = osprofiler.notifier.create("Messaging", # oslo_messaging, {}, # notifier.get_transport(), # "glance", "api", # cfg.CONF.bind_host) # osprofiler.notifier.set(_notifier) #else: # osprofiler.web.disable() server = wsgi.Server() server.start(config.load_paste_app('umbrella'), default_port=9801) server.wait() except Exception as e: fail(e)
def main(): try: config.parse_args() wsgi.set_eventlet_hub() logging.setup(CONF, 'umbrella') #if cfg.CONF.profiler.enabled: # _notifier = osprofiler.notifier.create("Messaging", # oslo_messaging, {}, # notifier.get_transport(), # "glance", "api", # cfg.CONF.bind_host) # osprofiler.notifier.set(_notifier) #else: # osprofiler.web.disable() server = wsgi.Server() server.start(config.load_paste_app('umbrella'), default_port=9801) server.wait() except Exception as e: fail(e)
def main(): CONF.register_cli_opt(command_opt) if len(sys.argv) < 2: script_name = sys.argv[0] print("%s category action [<args>]" % script_name) print(_("Available categories:")) for category in CATEGORIES: print(_("\t%s") % category) sys.exit(2) try: logging.register_options(CONF) cfg_files = cfg.find_config_files(project='umbrella', prog='umbrella-api') cfg_files.extend(cfg.find_config_files(project='umbrella', prog='umbrella-manage')) config.parse_args(default_config_files=cfg_files) logging.setup(CONF, 'umbrella') except RuntimeError as e: sys.exit("ERROR: %s" % e) try: if CONF.command.action.startswith('db'): return CONF.command.action_fn() else: func_kwargs = {} for k in CONF.command.action_kwargs: v = getattr(CONF.command, 'action_kwarg_' + k) if v is None: continue if isinstance(v, six.string_types): v = encodeutils.safe_decode(v) func_kwargs[k] = v func_args = [encodeutils.safe_decode(arg) for arg in CONF.command.action_args] return CONF.command.action_fn(*func_args, **func_kwargs) except Exception as e: sys.exit("ERROR: %s" % utils.exception_to_str(e))