예제 #1
0
def main():
    try:
        config.parse_args()
        config.set_config_defaults()
        wsgi.set_eventlet_hub()
        logging.setup(CONF, 'searchlight')
        utils.register_plugin_opts()

        # Fail fast if service policy files aren't found
        service_policies.check_policy_files()

        if CONF.profiler.enabled:
            _notifier = osprofiler.notifier.create("Messaging",
                                                   notifier.messaging, {},
                                                   notifier.get_transport(),
                                                   "searchlight", "search",
                                                   CONF.api.bind_host)
            osprofiler.notifier.set(_notifier)
        else:
            osprofiler.web.disable()

        server = wsgi.Server(workers=CONF.api.workers)
        server.start(config.load_paste_app('searchlight'),
                     default_port=9393)
        server.wait()
    except KNOWN_EXCEPTIONS as e:
        fail(e)
예제 #2
0
def prepare_service(argv=None):
    oslo_i18n.enable_lazy()
    log.set_defaults(_DEFAULT_LOG_LEVELS)
    log.register_options(CONF)
    gmr.TextGuruMeditation.setup_autorun(version)
    utils.register_plugin_opts()

    if argv is None:
        argv = sys.argv
    CONF(argv[1:], project='searchlight')
    log.setup(cfg.CONF, 'searchlight')
    oslo_messaging.set_transport_defaults('searchlight')
예제 #3
0
def configure_wsgi():
    config.parse_args()
    config.set_config_defaults()
    logging.setup(CONF, 'searchlight')
    utils.register_plugin_opts()

    # Fail fast if service policy files aren't found
    service_policies.check_policy_files()

    if CONF.profiler.enabled:
        _notifier = osprofiler.notifier.create("Messaging", notifier.messaging,
                                               {}, notifier.get_transport(),
                                               "searchlight", "search",
                                               CONF.api.bind_host)
        osprofiler.notifier.set(_notifier)
    else:
        osprofiler.web.disable()
예제 #4
0
    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(args=[])
        self.addCleanup(CONF.reset)
        mox_fixture = self.useFixture(moxstubout.MoxStubout())
        self.stubs = mox_fixture.stubs
        self.stubs.Set(exception, "_FATAL_EXCEPTION_FORMAT_ERRORS", True)
        self.test_dir = self.useFixture(fixtures.TempDir()).path
        self.conf_dir = os.path.join(self.test_dir, "etc")
        utils.safe_mkdirs(self.conf_dir)
        self.set_policy()

        utils.register_plugin_opts()
예제 #5
0
    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(args=[], default_config_files=[])
        self.addCleanup(CONF.reset)

        mox_fixture = self.useFixture(moxstubout.MoxStubout())
        self.stubs = mox_fixture.stubs
        self.stubs.Set(exception, '_FATAL_EXCEPTION_FORMAT_ERRORS', True)
        self.test_dir = self.useFixture(fixtures.TempDir()).path
        self.conf_dir = os.path.join(self.test_dir, 'etc')
        utils.safe_mkdirs(self.conf_dir)
        self.set_policy()

        utils.register_plugin_opts()
예제 #6
0
파일: api.py 프로젝트: sjmc7/searchlight
def configure_wsgi():
    config.parse_args()
    config.set_config_defaults()
    logging.setup(CONF, 'searchlight')
    utils.register_plugin_opts()

    # Fail fast if service policy files aren't found
    service_policies.check_policy_files()

    if CONF.profiler.enabled:
        _notifier = osprofiler.notifier.create("Messaging",
                                               notifier.messaging, {},
                                               notifier.get_transport(),
                                               "searchlight", "search",
                                               CONF.api.bind_host)
        osprofiler.notifier.set(_notifier)
    else:
        osprofiler.web.disable()
예제 #7
0
    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(args=[], default_config_files=[])
        self.addCleanup(CONF.reset)

        self.mock_exception = mock.patch('searchlight.common.exception', True)
        self.mock_exception.start()

        self.test_dir = self.useFixture(fixtures.TempDir()).path
        self.conf_dir = os.path.join(self.test_dir, 'etc')
        utils.safe_mkdirs(self.conf_dir)
        service_policies._ENFORCERS = None
        self.set_policy()

        utils.register_plugin_opts()
예제 #8
0
def configure_wsgi():
    # NOTE(hberaud): Call reset to ensure the ConfigOpts object doesn't
    # already contain registered options if the app is reloaded.
    CONF.reset()
    config.parse_args()
    config.set_config_defaults()
    logging.setup(CONF, 'searchlight')
    gmr.TextGuruMeditation.setup_autorun(version)
    utils.register_plugin_opts()

    # Fail fast if service policy files aren't found
    service_policies.check_policy_files()

    if CONF.profiler.enabled:
        _notifier = osprofiler.notifier.create("Messaging", notifier.messaging,
                                               {}, notifier.get_transport(),
                                               "searchlight", "search",
                                               CONF.api.bind_host)
        osprofiler.notifier.set(_notifier)
    else:
        osprofiler.web.disable()
예제 #9
0
    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(args=[], default_config_files=[])
        self.addCleanup(CONF.reset)
        mox_fixture = self.useFixture(moxstubout.MoxStubout())
        self.stubs = mox_fixture.stubs

        self.mock_exception = mock.patch(
            'searchlight.common.exception',
            True)
        self.mock_exception.start()

        self.test_dir = self.useFixture(fixtures.TempDir()).path
        self.conf_dir = os.path.join(self.test_dir, 'etc')
        utils.safe_mkdirs(self.conf_dir)
        service_policies._ENFORCERS = None
        self.set_policy()

        utils.register_plugin_opts()
예제 #10
0
파일: api.py 프로젝트: neha08/searchlight
def main():
    try:
        config.parse_args()
        wsgi.set_eventlet_hub()
        logging.setup(CONF, 'searchlight')
        utils.register_plugin_opts()

        if CONF.profiler.enabled:
            _notifier = osprofiler.notifier.create("Messaging",
                                                   notifier.messaging, {},
                                                   notifier.get_transport(),
                                                   "searchlight", "search",
                                                   CONF.api.bind_host)
            osprofiler.notifier.set(_notifier)
        else:
            osprofiler.web.disable()

        server = wsgi.Server(workers=CONF.api.workers)
        server.start(config.load_paste_app('searchlight'),
                     default_port=9393)
        server.wait()
    except KNOWN_EXCEPTIONS as e:
        fail(e)
예제 #11
0
 def __init__(self):
     utils.register_plugin_opts()
예제 #12
0
 def __init__(self):
     utils.register_plugin_opts()