diff --git a/npbackup/core/runner.py b/npbackup/core/runner.py index 613bcd0..3c5d780 100644 --- a/npbackup/core/runner.py +++ b/npbackup/core/runner.py @@ -315,7 +315,6 @@ class NPBackupRunner: self.minimum_backup_age = 1440 self.restic_runner.verbose = self.verbose - self.restic_runner.dry_run = self.dry_run self.restic_runner.stdout = self.stdout @exec_timer @@ -498,6 +497,7 @@ class NPBackupRunner: ) ) + self.restic_runner.dry_run = self.dry_run result, result_string = self.restic_runner.backup( paths=paths, exclude_patterns=exclude_patterns, @@ -508,7 +508,6 @@ class NPBackupRunner: use_fs_snapshot=use_fs_snapshot, tags=tags, additional_parameters=additional_parameters, - dry_run=self.dry_run, ) logger.debug("Restic output:\n{}".format(result_string)) metric_writer(self.config_dict, result, result_string) diff --git a/npbackup/restic_wrapper/__init__.py b/npbackup/restic_wrapper/__init__.py index 0d4e81d..78ad826 100644 --- a/npbackup/restic_wrapper/__init__.py +++ b/npbackup/restic_wrapper/__init__.py @@ -181,6 +181,8 @@ 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: @@ -486,7 +488,6 @@ 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]: """ @@ -524,8 +525,6 @@ class ResticRunner: tag = tag.strip() if tag: cmd += " --tag {}".format(tag) - if dry_run: - cmd += " --dry-run" if additional_parameters: cmd += " {}".format(additional_parameters) result, output = self.executor(cmd, live_stream=True)