소스 검색

Merge pull request #577 from Profpatsch/master

Fix upgrade without ~/attic/keys existing.
TW 9 년 전
부모
커밋
3496fc4665
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      borg/upgrader.py

+ 3 - 1
borg/upgrader.py

@@ -267,10 +267,12 @@ class AtticKeyfileKey(KeyfileKey):
         get_keys_dir = cls.get_keys_dir
         id = hexlify(repository.id).decode('ascii')
         keys_dir = get_keys_dir()
+        if not os.path.exists(keys_dir):
+            raise KeyfileNotFoundError(repository.path, keys_dir)
         for name in os.listdir(keys_dir):
             filename = os.path.join(keys_dir, name)
             with open(filename, 'r') as fd:
                 line = fd.readline().strip()
                 if line and line.startswith(cls.FILE_ID) and line[10:] == id:
                     return filename
-        raise KeyfileNotFoundError(repository.path, get_keys_dir())
+        raise KeyfileNotFoundError(repository.path, keys_dir)