mirror of
https://github.com/netinvent/npbackup.git
synced 2024-09-21 15:26:24 +08:00
Add backend binary to log file
This commit is contained in:
parent
371b143946
commit
12789e285e
|
@ -404,6 +404,7 @@ This is free software, and you are welcome to redistribute it under certain cond
|
|||
npbackup_runner = NPBackupRunner(config_dict=config_dict)
|
||||
npbackup_runner.dry_run = dry_run
|
||||
npbackup_runner.verbose = _VERBOSE
|
||||
logger.info("Backend: {}".format(npbackup_runner.backend_version))
|
||||
|
||||
if args.check:
|
||||
if npbackup_runner.check_recent_backups():
|
||||
|
|
|
@ -128,6 +128,11 @@ class NPBackupRunner:
|
|||
# Configure that instance
|
||||
self.apply_config_to_restic_runner()
|
||||
|
||||
@property
|
||||
def backend_version(self):
|
||||
if self.restic_runner:
|
||||
return self.restic_runner.binary_version
|
||||
|
||||
@property
|
||||
def dry_run(self):
|
||||
return self._dry_run
|
||||
|
|
|
@ -7,8 +7,8 @@ __intname__ = "npbackup.restic_wrapper"
|
|||
__author__ = "Orsiris de Jong"
|
||||
__copyright__ = "Copyright (C) 2022-2023 NetInvent"
|
||||
__license__ = "GPL-3.0-only"
|
||||
__build__ = "2023030701"
|
||||
__version__ = "1.5.1"
|
||||
__build__ = "2023032901"
|
||||
__version__ = "1.6.0"
|
||||
|
||||
|
||||
from typing import Tuple, List, Optional, Callable, Union
|
||||
|
@ -361,6 +361,26 @@ class ResticRunner:
|
|||
raise ValueError("Non existent binary given: {}".format(value))
|
||||
self._binary = value
|
||||
|
||||
@property
|
||||
def binary_version(self) -> Optional[str]:
|
||||
if self._binary:
|
||||
_cmd = "{} version".format(self._binary)
|
||||
exit_code, output = command_runner(
|
||||
_cmd,
|
||||
timeout=60,
|
||||
split_streams=False,
|
||||
encoding="utf-8",
|
||||
priority=self._priority,
|
||||
io_priority=self._priority,
|
||||
)
|
||||
if exit_code == 0:
|
||||
return output
|
||||
else:
|
||||
logger.error("Cannot get backend version: {}".format(output))
|
||||
else:
|
||||
logger.error("Cannot get backend version: No binary defined.")
|
||||
return None
|
||||
|
||||
@property
|
||||
def generic_arguments(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue