def _init_middleware(): """Initialize WSGI middleware. :returns: None """ # Ensure original root app is restored and wrap it with ProxyFix, # respecting only the last entry in each header if it contains a list of # values. The following headers are respected: X-Forwarded-For, # X-Forwarded-Proto, X-Forwarded-Host, X-Forwarded-Port, # X-Forwarded-Prefix (the last one sets SCRIPT_NAME environment variable # that is used to construct links). _app.wsgi_app = proxy_fix.ProxyFix(_wsgi_app, x_for=1, x_proto=1, x_host=1, x_port=1, x_prefix=1) if CONF.auth_strategy == 'keystone': utils.add_auth_middleware(_app) elif CONF.auth_strategy == 'http_basic': utils.add_basic_auth_middleware(_app) else: LOG.warning('Starting unauthenticated, please check' ' configuration') utils.add_cors_middleware(_app)
def _init_middleware(): """Initialize WSGI middleware. :returns: None """ if CONF.auth_strategy != 'noauth': utils.add_auth_middleware(_app) else: LOG.warning('Starting unauthenticated, please check' ' configuration') utils.add_cors_middleware(_app)
def _init_middleware(self): """Initialize WSGI middleware. :returns: None """ if CONF.auth_strategy != 'noauth': utils.add_auth_middleware(self.app) else: LOG.warning('Starting unauthenticated, please check' ' configuration') utils.add_cors_middleware(self.app)
def _init_middleware(): """Initialize WSGI middleware. :returns: None """ # ensure original root app is restored before wrapping it _app.wsgi_app = _wsgi_app if CONF.auth_strategy == 'keystone': utils.add_auth_middleware(_app) elif CONF.auth_strategy == 'http_basic': utils.add_basic_auth_middleware(_app) else: LOG.warning('Starting unauthenticated, please check' ' configuration') utils.add_cors_middleware(_app)
def init(self): if utils.get_auth_strategy() != 'noauth': utils.add_auth_middleware(app) else: LOG.warning(_LW('Starting unauthenticated, please check' ' configuration')) if CONF.processing.store_data == 'none': LOG.warning(_LW('Introspection data will not be stored. Change ' '"[processing] store_data" option if this is not ' 'the desired behavior')) elif CONF.processing.store_data == 'swift': LOG.info(_LI('Introspection data will be stored in Swift in the ' 'container %s'), CONF.swift.container) utils.add_cors_middleware(app) db.init() try: hooks = [ext.name for ext in plugins_base.processing_hooks_manager()] except KeyError as exc: # callback function raises MissingHookError derived from KeyError # on missing hook LOG.critical(_LC('Hook(s) %s failed to load or was not found'), str(exc)) sys.exit(1) LOG.info(_LI('Enabled processing hooks: %s'), hooks) if CONF.firewall.manage_firewall: firewall.init() periodic_update_ = periodics.periodic( spacing=CONF.firewall.firewall_update_period, enabled=CONF.firewall.manage_firewall )(periodic_update) periodic_clean_up_ = periodics.periodic( spacing=CONF.clean_up_period )(periodic_clean_up) self._periodics_worker = periodics.PeriodicWorker( callables=[(periodic_update_, None, None), (periodic_clean_up_, None, None)], executor_factory=periodics.ExistingExecutor(utils.executor())) utils.executor().submit(self._periodics_worker.start)
def init(self): if CONF.auth_strategy != 'noauth': utils.add_auth_middleware(app) else: LOG.warning('Starting unauthenticated, please check' ' configuration') if CONF.processing.store_data == 'none': LOG.warning('Introspection data will not be stored. Change ' '"[processing] store_data" option if this is not ' 'the desired behavior') elif CONF.processing.store_data == 'swift': LOG.info( 'Introspection data will be stored in Swift in the ' 'container %s', CONF.swift.container) utils.add_cors_middleware(app) db.init() try: hooks = [ ext.name for ext in plugins_base.processing_hooks_manager() ] except KeyError as exc: # callback function raises MissingHookError derived from KeyError # on missing hook LOG.critical('Hook(s) %s failed to load or was not found', str(exc)) sys.exit(1) LOG.info('Enabled processing hooks: %s', hooks) if CONF.firewall.manage_firewall: firewall.init() periodic_update_ = periodics.periodic( spacing=CONF.firewall.firewall_update_period, enabled=CONF.firewall.manage_firewall)(periodic_update) periodic_clean_up_ = periodics.periodic( spacing=CONF.clean_up_period)(periodic_clean_up) self._periodics_worker = periodics.PeriodicWorker( callables=[(periodic_update_, None, None), (periodic_clean_up_, None, None)], executor_factory=periodics.ExistingExecutor(utils.executor())) utils.executor().submit(self._periodics_worker.start)
def init(self): if utils.get_auth_strategy() != 'noauth': utils.add_auth_middleware(app) else: LOG.warning( _LW('Starting unauthenticated, please check' ' configuration')) if CONF.processing.store_data == 'none': LOG.warning( _LW('Introspection data will not be stored. Change ' '"[processing] store_data" option if this is not ' 'the desired behavior')) elif CONF.processing.store_data == 'swift': LOG.info( _LI('Introspection data will be stored in Swift in the ' 'container %s'), CONF.swift.container) utils.add_cors_middleware(app) db.init() try: hooks = [ ext.name for ext in plugins_base.processing_hooks_manager() ] except KeyError as exc: # stevedore raises KeyError on missing hook LOG.critical(_LC('Hook %s failed to load or was not found'), str(exc)) sys.exit(1) LOG.info(_LI('Enabled processing hooks: %s'), hooks) if CONF.firewall.manage_firewall: firewall.init() self._periodics_worker = periodics.PeriodicWorker( callables=[(periodic_update, None, None), (periodic_clean_up, None, None)], executor_factory=periodics.ExistingExecutor(utils.executor())) utils.executor().submit(self._periodics_worker.start)
def _init_middleware(self): """Initialize WSGI middleware. :returns: None """ if CONF.auth_strategy != 'noauth': utils.add_auth_middleware(self.app) else: LOG.warning('Starting unauthenticated, please check' ' configuration') # TODO(aarefiev): move to WorkerService once we split service if CONF.processing.store_data == 'none': LOG.warning('Introspection data will not be stored. Change ' '"[processing] store_data" option if this is not ' 'the desired behavior') elif CONF.processing.store_data == 'swift': LOG.info( 'Introspection data will be stored in Swift in the ' 'container %s', CONF.swift.container) utils.add_cors_middleware(self.app)