def setup_app(pecan_config=None, extra_hooks=None): app_conf = get_pecan_config() client = rpc.get_client() storage_backend = storage.get_storage() app_hooks = [ hooks.RPCHook(client), hooks.StorageHook(storage_backend), ] if CONF.auth_strategy == 'keystone': app_hooks.append(hooks.ContextHook()) app = pecan.make_app(app_conf.app.root, static_root=app_conf.app.static_root, template_path=app_conf.app.template_path, debug=CONF.api.pecan_debug, force_canonical=getattr(app_conf.app, 'force_canonical', True), hooks=app_hooks, guess_content_type_from_ext=False) return app
def setup_app(pecan_config=None, extra_hooks=None): app_conf = get_pecan_config() client = rpc.get_client() storage_backend = storage.get_storage() app_hooks = [ hooks.RPCHook(client), hooks.StorageHook(storage_backend), ] if CONF.auth_strategy == 'keystone': app_hooks.append(hooks.ContextHook()) app = pecan.make_app( app_conf.app.root, static_root=app_conf.app.static_root, template_path=app_conf.app.template_path, debug=CONF.api.pecan_debug, force_canonical=getattr(app_conf.app, 'force_canonical', True), hooks=app_hooks, guess_content_type_from_ext=False ) if CONF.auth_strategy == 'keystone': return middleware.AuthTokenMiddleware(app, dict(CONF), app_conf.app.acl_public_routes) else: return app
def set_state(self, enabled): """Enable or disable a module. :param enabled: (bool) The state to put the module in. :return: bool """ api = db_api.get_instance() module_db = api.get_module_info() client = rpc.get_client().prepare(namespace='rating', fanout=True) if enabled: operation = 'enable_module' else: operation = 'disable_module' client.cast({}, operation, name=self.module_name) return module_db.set_state(self.module_name, enabled)
def notify_reload(self): client = rpc.get_client().prepare(namespace='rating', fanout=True) client.cast({}, 'reload_module', name=self.module_name)