Exemplo n.º 1
0
def parse_args(argv=None, config_file=None):
    """Loads application configuration.

    Loads entire application configuration just once.

    """
    global _CONF_LOADED
    if _CONF_LOADED:
        LOG.debug('Configuration has been already loaded')
        return

    log.set_defaults()
    log.register_options(CONF)

    argv = (argv if argv is not None else sys.argv[1:])
    args = ([] if _is_running_under_gunicorn() else argv or [])
    config_file = (_get_deprecated_config_file()
                   if config_file is None else config_file)

    CONF(args=args,
         prog='api',
         project='monasca',
         version=version.version_str,
         default_config_files=[config_file] if config_file else None,
         description='RESTful API for alarming in the cloud')

    log.setup(CONF,
              product_name='monasca-api',
              version=version.version_str)
    conf.register_opts()

    _CONF_LOADED = True
Exemplo n.º 2
0
def parse_args(argv=None):
    """Loads application configuration.

    Loads entire application configuration just once.

    """
    global _CONF_LOADED
    if _CONF_LOADED:
        LOG.debug('Configuration has been already loaded')
        return

    log.set_defaults()
    log.register_options(CONF)

    argv = (argv if argv is not None else sys.argv[1:])
    args = ([] if _is_running_under_gunicorn() else argv or [])

    CONF(args=args,
         prog=sys.argv[1:],
         project='monasca',
         version=version.version_str,
         default_config_files=get_config_files(),
         description='RESTful API for alarming in the cloud')

    log.setup(CONF, product_name='monasca-api', version=version.version_str)
    conf.register_opts()
    policy_opts.set_defaults(CONF)

    _CONF_LOADED = True
Exemplo n.º 3
0
def main():
    CONF.register_cli_opt(command_opt)
    CONF(args=sys.argv[1:],
         default_config_files=monasca_api.config.get_config_files(),
         prog='api',
         project='monasca',
         version=version.version_str)

    conf.register_opts()

    CONF.command.func()
Exemplo n.º 4
0
def main():
    CONF.register_cli_opt(command_opt)
    CONF(args=sys.argv[1:],
         default_config_files=monasca_api.config.get_config_files(),
         prog='api',
         project='monasca',
         version=version.version_str)

    conf.register_opts()

    CONF.command.func()
Exemplo n.º 5
0
 def setUp(self):
     super(ConfigFixture, self).setUp()
     self.addCleanup(self._clean_config_loaded_flag)
     conf.register_opts()
     self._set_defaults()
     config.parse_args(argv=[])  # prevent oslo from parsing test args
Exemplo n.º 6
0
 def setUp(self):
     super(ConfigFixture, self).setUp()
     self.addCleanup(self._clean_config_loaded_flag)
     conf.register_opts()
     self._set_defaults()
     config.parse_args(argv=[])  # prevent oslo from parsing test args