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