示例#1
0
文件: simple.py 项目: secmff/obnam
 def commit(self):
     if not self._lock.got_lock:
         raise obnamlib.RepositoryClientListNotLocked()
     tracing.trace('client list: %r', self._data._obj)
     for client_name in self._added_clients:
         self._hooks.call('repository-add-client', self, client_name)
     self._data.save()
     self._added_clients = []
     self._lock.unchecked_unlock()
示例#2
0
文件: simple.py 项目: secmff/obnam
    def remove_client(self, client_name):
        if not self._lock.got_lock:
            raise obnamlib.RepositoryClientListNotLocked()

        self._require_client_exists(client_name)

        clients = self._data.get('clients', {})
        del clients[client_name]
        self._data['clients'] = clients

        if client_name in self._added_clients:
            self._added_clients.remove(client_name)
示例#3
0
文件: simple.py 项目: secmff/obnam
    def add_client(self, client_name):
        if not self._lock.got_lock:
            raise obnamlib.RepositoryClientListNotLocked()

        self._require_client_does_not_exist(client_name)

        clients = self._data.get('clients', {})
        clients[client_name] = {
            'encryption-key': None,
        }
        self._data['clients'] = clients

        self._added_clients.append(client_name)
示例#4
0
文件: simple.py 项目: secmff/obnam
    def rename_client(self, old_client_name, new_client_name):
        if not self._lock.got_lock:
            raise obnamlib.RepositoryClientListNotLocked()

        self._require_client_exists(old_client_name)
        self._require_client_does_not_exist(new_client_name)

        clients = self._data.get('clients', {})
        clients[new_client_name] = clients[old_client_name]
        del clients[old_client_name]
        self._data['clients'] = clients

        if old_client_name in self._added_clients:  # pragma: no cover
            self._added_clients.remove(old_client_name)
        self._added_clients.append(new_client_name)
示例#5
0
 def _require_client_list_lock(self):
     if not self.got_client_list_lock():
         raise obnamlib.RepositoryClientListNotLocked()
示例#6
0
 def _raw_unlock_client_list(self):
     if not self.got_client_list_lock():
         raise obnamlib.RepositoryClientListNotLocked()
     self._lockmgr.unlock(['.'])
     self._setup_client_list()
示例#7
0
 def _require_lock(self):
     if not self.data.locked:
         raise obnamlib.RepositoryClientListNotLocked()
示例#8
0
 def commit(self):
     if not self.data.locked:
         raise obnamlib.RepositoryClientListNotLocked()
     self.data.commit()
示例#9
0
 def unlock(self):
     if not self.data.locked:
         raise obnamlib.RepositoryClientListNotLocked()
     self.data.unlock()
示例#10
0
文件: simple.py 项目: secmff/obnam
 def unlock(self):
     if not self._lock.got_lock:
         raise obnamlib.RepositoryClientListNotLocked()
     self._data.clear()
     self._lock.unchecked_unlock()