Skip to content

Commit

Permalink
Fix broken repository detection in the "rcreate" action with Borg 1.4…
Browse files Browse the repository at this point in the history
… (#820).
  • Loading branch information
witten committed Jan 24, 2024
1 parent 0090621 commit ad1d104
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions borgmatic/borg/rcreate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
logger = logging.getLogger(__name__)


RINFO_REPOSITORY_NOT_FOUND_EXIT_CODE = 2
RINFO_REPOSITORY_NOT_FOUND_EXIT_CODES = {2, 13}


def create_repository(
Expand Down Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/borg/test_rcreate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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], [])
)


Expand Down

0 comments on commit ad1d104

Please sign in to comment.