Revert "Fix --dry-run parameter wasn't working since refactoring"

This reverts commit dc6e7e0cc1.
This commit is contained in:
Orsiris de Jong 2023-03-01 18:59:10 +01:00
parent f867ae6415
commit 825ebcf478

View file

@ -7,8 +7,8 @@ __intname__ = "npbackup.restic_wrapper"
__author__ = "Orsiris de Jong"
__copyright__ = "Copyright (C) 2022-2023 NetInvent"
__license__ = "GPL-3.0-only"
__build__ = "2023030101"
__version__ = "1.5.1"
__build__ = "2023012701"
__version__ = "1.5.0"
from typing import Tuple, List, Optional, Callable, Union
@ -181,8 +181,6 @@ class ResticRunner:
start_time = datetime.utcnow()
self._executor_finished = False
_cmd = '"{}" {}{}'.format(self._binary, cmd, self.generic_arguments)
if self.dry_run:
_cmd += " --dry-run"
logger.debug("Running command: [{}]".format(_cmd))
self._make_env()
if live_stream:
@ -488,6 +486,7 @@ class ResticRunner:
use_fs_snapshot: bool = False,
tags: List[str] = [],
one_file_system: bool = False,
dry_run: bool = False,
additional_parameters: str = None,
) -> Tuple[bool, str]:
"""
@ -523,6 +522,8 @@ class ResticRunner:
logger.warning(
"Parameter --use-fs-snapshot was given, which is only compatible with Windows"
)
if dry_run:
cmd += " --dry-run"
if additional_parameters:
cmd += " {}".format(additional_parameters)
result, output = self.executor(cmd, live_stream=True)