Ejemplo n.º 1
0
def initialize_application(name,
                           post_log_configured_function=lambda: None,
                           config_files=None):
    if not config_files:
        config_files = None

    common.configure(config_files=config_files)

    # Log the options used when starting if we're in debug mode...
    if CONF.debug:
        CONF.log_opt_values(logging.getLogger(CONF.prog), logging.DEBUG)

    post_log_configured_function()

    def loadapp():
        return keystone_service.loadapp(
            'config:%s' % config.find_paste_config(), name)

    _unused, application = common.setup_backends(
        startup_application_fn=loadapp)

    # setup OSprofiler notifier and enable the profiling if that is configured
    # in Keystone configuration file.
    profiler.setup(name)

    return application
Ejemplo n.º 2
0
def initialize_application(name):
    common.configure()

    # Log the options used when starting if we're in debug mode...
    if CONF.debug:
        CONF.log_opt_values(logging.getLogger(CONF.prog), logging.DEBUG)

    environment.use_stdlib()

    def loadapp():
        return keystone_service.loadapp(
            'config:%s' % config.find_paste_config(), name)

    _unused, application = common.setup_backends(
        startup_application_fn=loadapp)

    # Create a CORS wrapper, and attach keystone-specific defaults that must be
    # included in all CORS responses
    application = cors.CORS(application, CONF)
    application.set_latent(
        allow_headers=KEYSTONE_HEADERS,
        allow_methods=['GET', 'PUT', 'POST', 'DELETE', 'PATCH'],
        expose_headers=KEYSTONE_HEADERS
    )
    return application
Ejemplo n.º 3
0
def initialize_application(name, post_log_configured_function=lambda: None):
    common.configure()

    # Log the options used when starting if we're in debug mode...
    if CONF.debug:
        CONF.log_opt_values(logging.getLogger(CONF.prog), logging.DEBUG)

    environment.use_stdlib()

    post_log_configured_function()

    def loadapp():
        return keystone_service.loadapp(
            'config:%s' % config.find_paste_config(), name)

    _unused, application = common.setup_backends(
        startup_application_fn=loadapp)

    # Create a CORS wrapper, and attach keystone-specific defaults that must be
    # included in all CORS responses
    application = cors.CORS(application, CONF)
    application.set_latent(
        allow_headers=KEYSTONE_HEADERS,
        allow_methods=['GET', 'PUT', 'POST', 'DELETE', 'PATCH'],
        expose_headers=KEYSTONE_HEADERS)
    return application
Ejemplo n.º 4
0
def initialize_application(name,
                           post_log_configured_function=lambda: None,
                           config_files=None):
    possible_topdir = os.path.normpath(
        os.path.join(os.path.abspath(__file__), os.pardir, os.pardir,
                     os.pardir))

    dev_conf = os.path.join(possible_topdir, 'etc', 'keystone.conf')
    if not config_files:
        config_files = None
        if os.path.exists(dev_conf):
            config_files = [dev_conf]

    common.configure(config_files=config_files)

    # Log the options used when starting if we're in debug mode...
    if CONF.debug:
        CONF.log_opt_values(log.getLogger(CONF.prog), log.DEBUG)

    post_log_configured_function()

    def loadapp():
        return keystone_service.loadapp('config:%s' % find_paste_config(),
                                        name)

    _unused, application = common.setup_backends(
        startup_application_fn=loadapp)

    # setup OSprofiler notifier and enable the profiling if that is configured
    # in Keystone configuration file.
    profiler.setup(name)

    return application
Ejemplo n.º 5
0
def initialize_application(name,
                           post_log_configured_function=lambda: None,
                           config_files=None):
    if not config_files:
        config_files = None

    common.configure(config_files=config_files)

    # Log the options used when starting if we're in debug mode...
    if CONF.debug:
        CONF.log_opt_values(logging.getLogger(CONF.prog), logging.DEBUG)

    post_log_configured_function()

    def loadapp():
        return keystone_service.loadapp(
            'config:%s' % config.find_paste_config(), name)

    _unused, application = common.setup_backends(
        startup_application_fn=loadapp)

    # setup OSprofiler notifier and enable the profiling if that is configured
    # in Keystone configuration file.
    profiler.setup(name)

    return application
Ejemplo n.º 6
0
def run(possible_topdir):
    dev_conf = os.path.join(possible_topdir, 'etc', 'keystone.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    common.configure(
        version=pbr.version.VersionInfo('keystone').version_string(),
        config_files=config_files,
        pre_setup_logging_fn=configure_threading)

    paste_config = config.find_paste_config()

    def create_servers():
        admin_worker_count = _get_workers('admin_workers')
        public_worker_count = _get_workers('public_workers')

        servers = []
        servers.append(
            create_server(paste_config, 'admin',
                          CONF.eventlet_server.admin_bind_host,
                          CONF.eventlet_server.admin_port, admin_worker_count))
        servers.append(
            create_server(paste_config, 'main',
                          CONF.eventlet_server.public_bind_host,
                          CONF.eventlet_server.public_port,
                          public_worker_count))
        return servers

    _unused, servers = common.setup_backends(
        startup_application_fn=create_servers)
    serve(*servers)
Ejemplo n.º 7
0
def initialize_application(name,
                           post_log_configured_function=lambda: None,
                           config_files=None):
    possible_topdir = os.path.normpath(
        os.path.join(os.path.abspath(__file__), os.pardir, os.pardir,
                     os.pardir))

    dev_conf = os.path.join(possible_topdir, 'etc', 'keystone.conf')
    if not config_files:
        config_files = None
        if os.path.exists(dev_conf):
            config_files = [dev_conf]

    common.configure(config_files=config_files)

    # Log the options used when starting if we're in debug mode...
    if CONF.debug:
        CONF.log_opt_values(log.getLogger(CONF.prog), log.DEBUG)

    post_log_configured_function()

    # TODO(morgan): Provide a better mechanism than "loadapp", this was for
    # paste-deploy specific mechanisms.
    def loadapp():
        app = application.application_factory(name)
        return app

    _unused, app = common.setup_backends(startup_application_fn=loadapp)

    # setup OSprofiler notifier and enable the profiling if that is configured
    # in Keystone configuration file.
    profiler.setup(name)

    return setup_app_middleware(app)
Ejemplo n.º 8
0
def run(possible_topdir):
    dev_conf = os.path.join(possible_topdir,
                            'etc',
                            'keystone.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    common.configure(
        version=pbr.version.VersionInfo('keystone').version_string(),
        config_files=config_files,
        pre_setup_logging_fn=configure_threading)

    paste_config = config.find_paste_config()

    def create_servers():
        admin_worker_count = _get_workers('admin_workers')
        public_worker_count = _get_workers('public_workers')

        servers = []
        servers.append(create_server(paste_config,
                                     'admin',
                                     CONF.eventlet_server.admin_bind_host,
                                     CONF.eventlet_server.admin_port,
                                     admin_worker_count))
        servers.append(create_server(paste_config,
                                     'main',
                                     CONF.eventlet_server.public_bind_host,
                                     CONF.eventlet_server.public_port,
                                     public_worker_count))
        return servers

    _unused, servers = common.setup_backends(
        startup_application_fn=create_servers)
    serve(*servers)
Ejemplo n.º 9
0
    def setUp(self):
        super(BackendLoader, self).setUp()

        self.clear_auth_plugin_registry()
        drivers, _unused = common.setup_backends()

        for manager_name, manager in drivers.items():
            setattr(self._testcase, manager_name, manager)

        self.addCleanup(self._testcase.cleanup_instance(*list(drivers.keys())))

        del self._testcase  # break circular reference
Ejemplo n.º 10
0
    def setUp(self):
        super(BackendLoader, self).setUp()

        self.clear_auth_plugin_registry()
        drivers, _unused = common.setup_backends()

        for manager_name, manager in drivers.items():
            setattr(self._testcase, manager_name, manager)

        self.addCleanup(self._testcase.cleanup_instance(*list(drivers.keys())))

        del self._testcase  # break circular reference
Ejemplo n.º 11
0
def initialize_application(name):
    common.configure()

    # Log the options used when starting if we're in debug mode...
    if CONF.debug:
        CONF.log_opt_values(logging.getLogger(CONF.prog), logging.DEBUG)

    environment.use_stdlib()

    def loadapp():
        return keystone_service.loadapp("config:%s" % config.find_paste_config(), name)

    _unused, application = common.setup_backends(startup_application_fn=loadapp)
    return application
Ejemplo n.º 12
0
def initialize_application(name):
    common.configure()

    # Log the options used when starting if we're in debug mode...
    if CONF.debug:
        CONF.log_opt_values(logging.getLogger(CONF.prog), logging.DEBUG)

    environment.use_stdlib()

    def loadapp():
        return keystone_service.loadapp(
            'config:%s' % config.find_paste_config(), name)

    _unused, application = common.setup_backends(
        startup_application_fn=loadapp)
    return application
Ejemplo n.º 13
0
    def setUp(self):
        super(BackendLoader, self).setUp()

        # TODO(blk-u): Shouldn't need to clear the registry here, but some
        # tests call load_backends multiple times. These should be fixed to
        # only call load_backends once.
        dependency.reset()

        self.clear_auth_plugin_registry()
        drivers, _unused = common.setup_backends()

        for manager_name, manager in drivers.items():
            setattr(self._testcase, manager_name, manager)

        self.addCleanup(self._testcase.cleanup_instance(*list(drivers.keys())))

        del self._testcase  # break circular reference
Ejemplo n.º 14
0
    def setUp(self):
        super(BackendLoader, self).setUp()

        # TODO(blk-u): Shouldn't need to clear the registry here, but some
        # tests call load_backends multiple times. These should be fixed to
        # only call load_backends once.
        dependency.reset()

        self.clear_auth_plugin_registry()
        drivers, _unused = common.setup_backends()

        for manager_name, manager in drivers.items():
            setattr(self._testcase, manager_name, manager)

        self.addCleanup(self._testcase.cleanup_instance(*list(drivers.keys())))

        del self._testcase  # break circular reference
Ejemplo n.º 15
0
def run(possible_topdir):
    dev_conf = os.path.join(possible_topdir,
                            'etc',
                            'keystone.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    common.configure(
        version=pbr.version.VersionInfo('keystone').version_string(),
        config_files=config_files)

    paste_config = config.find_paste_config()

    monkeypatch_thread = not CONF.standard_threads
    pydev_debug_url = utils.setup_remote_pydev_debug()
    if pydev_debug_url:
        # in order to work around errors caused by monkey patching we have to
        # set the thread to False.  An explanation is here:
        # http://lists.openstack.org/pipermail/openstack-dev/2012-August/
        # 000794.html
        monkeypatch_thread = False
    environment.use_eventlet(monkeypatch_thread)

    def create_servers():
        admin_worker_count = _get_workers('admin_workers')
        public_worker_count = _get_workers('public_workers')

        servers = []
        servers.append(create_server(paste_config,
                                     'admin',
                                     CONF.eventlet_server.admin_bind_host,
                                     CONF.eventlet_server.admin_port,
                                     admin_worker_count))
        servers.append(create_server(paste_config,
                                     'main',
                                     CONF.eventlet_server.public_bind_host,
                                     CONF.eventlet_server.public_port,
                                     public_worker_count))
        return servers

    _unused, servers = common.setup_backends(
        startup_application_fn=create_servers)
    serve(*servers)
Ejemplo n.º 16
0
    def load_backends(self):
        """Initialize each manager and assigns them to an attribute."""
        # TODO(blk-u): Shouldn't need to clear the registry here, but some
        # tests call load_backends multiple times. These should be fixed to
        # only call load_backends once.
        dependency.reset()

        # TODO(morganfainberg): Shouldn't need to clear the registry here, but
        # some tests call load_backends multiple times.  Since it is not
        # possible to re-configure a backend, we need to clear the list.  This
        # should eventually be removed once testing has been cleaned up.
        kvs_core.KEY_VALUE_STORE_REGISTRY.clear()

        self.clear_auth_plugin_registry()
        drivers, _unused = common.setup_backends()

        for manager_name, manager in drivers.items():
            setattr(self, manager_name, manager)
        self.addCleanup(self.cleanup_instance(*list(drivers.keys())))
Ejemplo n.º 17
0
    def load_backends(self):
        """Initializes each manager and assigns them to an attribute."""
        # TODO(blk-u): Shouldn't need to clear the registry here, but some
        # tests call load_backends multiple times. These should be fixed to
        # only call load_backends once.
        dependency.reset()

        # TODO(morganfainberg): Shouldn't need to clear the registry here, but
        # some tests call load_backends multiple times.  Since it is not
        # possible to re-configure a backend, we need to clear the list.  This
        # should eventually be removed once testing has been cleaned up.
        kvs_core.KEY_VALUE_STORE_REGISTRY.clear()

        self.clear_auth_plugin_registry()
        drivers, _unused = common.setup_backends(
            load_extra_backends_fn=self.load_extra_backends)

        for manager_name, manager in drivers.items():
            setattr(self, manager_name, manager)
        self.addCleanup(self.cleanup_instance(*list(drivers.keys())))
Ejemplo n.º 18
0
def run(possible_topdir):
    dev_conf = os.path.join(possible_topdir, 'etc', 'keystone.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    common.configure(
        version=pbr.version.VersionInfo('keystone').version_string(),
        config_files=config_files)

    paste_config = config.find_paste_config()

    monkeypatch_thread = not CONF.standard_threads
    pydev_debug_url = utils.setup_remote_pydev_debug()
    if pydev_debug_url:
        # in order to work around errors caused by monkey patching we have to
        # set the thread to False.  An explanation is here:
        # http://lists.openstack.org/pipermail/openstack-dev/2012-August/
        # 000794.html
        monkeypatch_thread = False
    environment.use_eventlet(monkeypatch_thread)

    def create_servers():
        admin_worker_count = _get_workers('admin_workers')
        public_worker_count = _get_workers('public_workers')

        servers = []
        servers.append(
            create_server(paste_config, 'admin',
                          CONF.eventlet_server.admin_bind_host,
                          CONF.eventlet_server.admin_port, admin_worker_count))
        servers.append(
            create_server(paste_config, 'main',
                          CONF.eventlet_server.public_bind_host,
                          CONF.eventlet_server.public_port,
                          public_worker_count))
        return servers

    _unused, servers = common.setup_backends(
        startup_application_fn=create_servers)
    serve(*servers)
Ejemplo n.º 19
0
def initialize_application(name, post_log_configured_function=lambda: None,
                           config_files=None):
    possible_topdir = os.path.normpath(os.path.join(
                                       os.path.abspath(__file__),
                                       os.pardir,
                                       os.pardir,
                                       os.pardir))

    dev_conf = os.path.join(possible_topdir,
                            'etc',
                            'keystone.conf')
    if not config_files:
        config_files = None
        if os.path.exists(dev_conf):
            config_files = [dev_conf]

    common.configure(config_files=config_files)

    # Log the options used when starting if we're in debug mode...
    if CONF.debug:
        CONF.log_opt_values(log.getLogger(CONF.prog), log.DEBUG)

    post_log_configured_function()

    # TODO(morgan): Provide a better mechanism than "loadapp", this was for
    # paste-deploy specific mechanisms.
    def loadapp():
        app = application.application_factory(name)
        return app

    _unused, app = common.setup_backends(
        startup_application_fn=loadapp)

    # setup OSprofiler notifier and enable the profiling if that is configured
    # in Keystone configuration file.
    profiler.setup(name)

    return setup_app_middleware(app)
Ejemplo n.º 20
0
    def setUp(self):
        super(BackendLoader, self).setUp()

        # TODO(blk-u): Shouldn't need to clear the registry here, but some
        # tests call load_backends multiple times. These should be fixed to
        # only call load_backends once.
        dependency.reset()

        # TODO(morganfainberg): Shouldn't need to clear the registry here, but
        # some tests call load_backends multiple times.  Since it is not
        # possible to re-configure a backend, we need to clear the list.  This
        # should eventually be removed once testing has been cleaned up.
        kvs_core.KEY_VALUE_STORE_REGISTRY.clear()

        self.clear_auth_plugin_registry()
        drivers, _unused = common.setup_backends()

        for manager_name, manager in drivers.items():
            setattr(self._testcase, manager_name, manager)

        self.addCleanup(self._testcase.cleanup_instance(*list(drivers.keys())))

        del self._testcase  # break circular reference
Ejemplo n.º 21
0
    def setUp(self):
        super(BackendLoader, self).setUp()

        # TODO(blk-u): Shouldn't need to clear the registry here, but some
        # tests call load_backends multiple times. These should be fixed to
        # only call load_backends once.
        dependency.reset()

        # TODO(morganfainberg): Shouldn't need to clear the registry here, but
        # some tests call load_backends multiple times.  Since it is not
        # possible to re-configure a backend, we need to clear the list.  This
        # should eventually be removed once testing has been cleaned up.
        kvs_core.KEY_VALUE_STORE_REGISTRY.clear()

        self.clear_auth_plugin_registry()
        drivers, _unused = common.setup_backends()

        for manager_name, manager in drivers.items():
            setattr(self._testcase, manager_name, manager)

        self.addCleanup(self._testcase.cleanup_instance(*list(drivers.keys())))

        del self._testcase  # break circular reference
Ejemplo n.º 22
0
def initialize_application(name,
                           post_log_configured_function=lambda: None,
                           config_files=None):
    possible_topdir = os.path.normpath(os.path.join(
                                       os.path.abspath(__file__),
                                       os.pardir,
                                       os.pardir,
                                       os.pardir))

    dev_conf = os.path.join(possible_topdir,
                            'etc',
                            'keystone.conf')
    if not config_files:
        config_files = None
        if os.path.exists(dev_conf):
            config_files = [dev_conf]

    common.configure(config_files=config_files)

    # Log the options used when starting if we're in debug mode...
    if CONF.debug:
        CONF.log_opt_values(log.getLogger(CONF.prog), log.DEBUG)

    post_log_configured_function()

    def loadapp():
        return keystone_service.loadapp(
            'config:%s' % find_paste_config(), name)

    _unused, application = common.setup_backends(
        startup_application_fn=loadapp)

    # setup OSprofiler notifier and enable the profiling if that is configured
    # in Keystone configuration file.
    profiler.setup(name)

    return application