From 3967e1b5f043000ba8435529a99be027669446bf Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 24 Jul 2017 19:29:26 -0700 Subject: [PATCH] #32: Fix for passing check_last as integer to subprocess when calling Borg. --- NEWS | 8 ++++++-- borgmatic/borg.py | 5 ++--- borgmatic/tests/unit/test_borg.py | 4 ++-- setup.py | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index a580bdc0..a4b6c8a6 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,11 @@ +1.1.2 + + * #32: Fix for passing check_last as integer to subprocess when calling Borg. + 1.1.1 - * #32: Fix for upgrade-borgmatic-config converting check_last option as a string instead of an - integer. + * Part of #32: Fix for upgrade-borgmatic-config converting check_last option as a string instead of + an integer. * Fix for upgrade-borgmatic-config erroring when consistency checks option is not present. 1.1.0 diff --git a/borgmatic/borg.py b/borgmatic/borg.py index f42353d2..8c4c7308 100644 --- a/borgmatic/borg.py +++ b/borgmatic/borg.py @@ -162,10 +162,9 @@ def _make_check_flags(checks, check_last=None): ('--repository-only',) - Additionally, if a check_last value is given, a "--last" flag will be added. Note that only - Borg supports this flag. + Additionally, if a check_last value is given, a "--last" flag will be added. ''' - last_flag = ('--last', check_last) if check_last else () + last_flag = ('--last', str(check_last)) if check_last else () if checks == DEFAULT_CHECKS: return last_flag diff --git a/borgmatic/tests/unit/test_borg.py b/borgmatic/tests/unit/test_borg.py index 36cc3121..4963ab53 100644 --- a/borgmatic/tests/unit/test_borg.py +++ b/borgmatic/tests/unit/test_borg.py @@ -409,13 +409,13 @@ def test_make_check_flags_with_default_checks_returns_no_flags(): def test_make_check_flags_with_checks_and_last_returns_flags_including_last(): flags = module._make_check_flags(('foo', 'bar'), check_last=3) - assert flags == ('--foo-only', '--bar-only', '--last', 3) + assert flags == ('--foo-only', '--bar-only', '--last', '3') def test_make_check_flags_with_last_returns_last_flag(): flags = module._make_check_flags(module.DEFAULT_CHECKS, check_last=3) - assert flags == ('--last', 3) + assert flags == ('--last', '3') def test_check_archives_should_call_borg_with_parameters(): diff --git a/setup.py b/setup.py index 9796fc4e..6d4cc7c3 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages -VERSION = '1.1.1' +VERSION = '1.1.2' setup(