فهرست منبع

Fix broken repository detection in the "rcreate" action with Borg 1.4 (#820).

Dan Helfman 1 سال پیش
والد
کامیت
ad1d104d65
3فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  1. 2 0
      NEWS
  2. 2 2
      borgmatic/borg/rcreate.py
  3. 1 1
      tests/unit/borg/test_rcreate.py

+ 2 - 0
NEWS

@@ -1,5 +1,7 @@
 1.8.8.dev0
  * #818: Allow the "--repository" flag to match across multiple configuration files.
+ * #820: Fix broken repository detection in the "rcreate" action with Borg 1.4. The issue did not
+   occur with other versions of Borg.
 
 1.8.7
  * #736: Store included configuration files within each backup archive in support of the "config

+ 2 - 2
borgmatic/borg/rcreate.py

@@ -8,7 +8,7 @@ from borgmatic.execute import DO_NOT_CAPTURE, execute_command
 logger = logging.getLogger(__name__)
 
 
-RINFO_REPOSITORY_NOT_FOUND_EXIT_CODE = 2
+RINFO_REPOSITORY_NOT_FOUND_EXIT_CODES = {2, 13}
 
 
 def create_repository(
@@ -45,7 +45,7 @@ def create_repository(
         logger.info(f'{repository_path}: Repository already exists. Skipping creation.')
         return
     except subprocess.CalledProcessError as error:
-        if error.returncode != RINFO_REPOSITORY_NOT_FOUND_EXIT_CODE:
+        if error.returncode not in RINFO_REPOSITORY_NOT_FOUND_EXIT_CODES:
             raise
 
     lock_wait = config.get('lock_wait')

+ 1 - 1
tests/unit/borg/test_rcreate.py

@@ -18,7 +18,7 @@ def insert_rinfo_command_found_mock():
 
 def insert_rinfo_command_not_found_mock():
     flexmock(module.rinfo).should_receive('display_repository_info').and_raise(
-        subprocess.CalledProcessError(module.RINFO_REPOSITORY_NOT_FOUND_EXIT_CODE, [])
+        subprocess.CalledProcessError(sorted(module.RINFO_REPOSITORY_NOT_FOUND_EXIT_CODES)[0], [])
     )