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