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 = messaging.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 reload(cls): super(ScopeState, cls).reload() cls._client = messaging.get_client() cls._storage_state = storage_state.StateManager()
def __init__(self): self._rpc_client = messaging.get_client()
def notify_reload(self): client = messaging.get_client().prepare(namespace='rating', fanout=True) client.cast({}, 'reload_module', name=self.module_name)
def __init__(self, *args, **kwargs): super(ScopeState, self).__init__(*args, **kwargs) self._client = messaging.get_client() self._storage_state = storage_state.StateManager()