Beispiel #1
0
def init_application(name):
    conf_files = _get_config_files()
    config.parse_args([], default_config_files=conf_files)

    logging.setup(CONF, "nova")
    try:
        _setup_service(CONF.host, name)
    except exception.ServiceTooOld as exc:
        return error_application(exc, name)

    service.setup_profiler(name, CONF.host)

    # dump conf at debug (log_options option comes from oslo.service)
    # FIXME(mriedem): This is gross but we don't have a public hook into
    # oslo.service to register these options, so we are doing it manually for
    # now; remove this when we have a hook method into oslo.service.
    CONF.register_opts(service_opts.service_opts)
    if CONF.log_options:
        CONF.log_opt_values(
            logging.getLogger(__name__),
            logging.DEBUG)

    conf = conf_files[0]

    return deploy.loadapp('config:%s' % conf, name=name)
Beispiel #2
0
def init_application(name):
    conf_files = _get_config_files()
    # NOTE(gibi): sys.argv is set by the wsgi runner e.g. uwsgi sets it based
    # on the --pyargv parameter of the uwsgi binary
    config.parse_args(sys.argv, default_config_files=conf_files)

    logging.setup(CONF, "nova")

    # dump conf at debug (log_options option comes from oslo.service)
    # FIXME(mriedem): This is gross but we don't have a public hook into
    # oslo.service to register these options, so we are doing it manually for
    # now; remove this when we have a hook method into oslo.service.
    CONF.register_opts(service_opts.service_opts)
    if CONF.log_options:
        CONF.log_opt_values(
            logging.getLogger(__name__),
            logging.DEBUG)

    try:
        _setup_service(CONF.host, name)
    except exception.ServiceTooOld as exc:
        return error_application(exc, name)

    service.setup_profiler(name, CONF.host)

    conf = conf_files[0]

    return deploy.loadapp('config:%s' % conf, name=name)
Beispiel #3
0
def init_application(name):
    conf_files = _get_config_files()
    config.parse_args([], default_config_files=conf_files)

    logging.setup(CONF, "nova")
    try:
        _setup_service(CONF.host, name)
    except exception.ServiceTooOld as exc:
        return error_application(exc, name)

    service.setup_profiler(name, CONF.host)

    conf = conf_files[0]

    return deploy.loadapp('config:%s' % conf, name=name)
Beispiel #4
0
def init_application(name):
    conf_files = _get_config_files()

    # NOTE(melwitt): The init_application method can be called multiple times
    # within a single python interpreter instance if any exception is raised
    # during it (example: DBConnectionError while setting up the service) and
    # apache/mod_wsgi reloads the init_application script. So, we initialize
    # global data separately and decorate the method to run only once in a
    # python interpreter instance.
    init_global_data(conf_files, name)

    try:
        _setup_service(CONF.host, name)
    except exception.ServiceTooOld as exc:
        return error_application(exc, name)

    # This global init is safe because if we got here, we already successfully
    # set up the service and setting up the profile cannot fail.
    service.setup_profiler(name, CONF.host)

    conf = conf_files[0]

    return deploy.loadapp('config:%s' % conf, name=name)