Browse Source

fix change-passphrase crashing if repository is not encrypted

Marian Beermann 8 years ago
parent
commit
7519bf8100
2 changed files with 4 additions and 0 deletions
  1. 3 0
      borg/archiver.py
  2. 1 0
      docs/changes.rst

+ 3 - 0
borg/archiver.py

@@ -177,6 +177,9 @@ class Archiver:
     @with_repository()
     def do_change_passphrase(self, args, repository, manifest, key):
         """Change repository key file passphrase"""
+        if not hasattr(key, 'change_passphrase'):
+            print('This repository is not encrypted, cannot change the passphrase.')
+            return EXIT_ERROR
         key.change_passphrase()
         logger.info('Key updated')
         return EXIT_SUCCESS

+ 1 - 0
docs/changes.rst

@@ -135,6 +135,7 @@ Bug fixes:
 - When running out of buffer memory when reading xattrs, only skip the current file, #1993
 - Fixed "borg upgrade --tam" crashing with unencrypted repositories. Since :ref:`the issue <tam_vuln>` is
   not relevant for unencrypted repositories, it now does nothing and prints an error, #1981.
+- Fixed change-passphrase crashing with unencrypted repositories, #1978
 
 Version 1.0.9 (2016-12-20)
 --------------------------