mirror of
https://github.com/netinvent/npbackup.git
synced 2025-11-12 07:01:37 +08:00
Refactor repo anonymizer code
This commit is contained in:
parent
9ab3fb8850
commit
774bc86b72
2 changed files with 10 additions and 4 deletions
|
|
@ -101,7 +101,7 @@ The x64 binary is compatible with Windows 10+. The x86 binary is compatible with
|
||||||
|
|
||||||
### PyPI installation
|
### PyPI installation
|
||||||
|
|
||||||
If you don't want to use the pre-built executables, you can install via pip with `pip install npbackup`.
|
If you don't want to use the pre-built executables, you can install via pip with `pip install npbackup` or `pip install npbackup==3.0.0rc8` currently.
|
||||||
|
|
||||||
Python requirement: 3.7+
|
Python requirement: 3.7+
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ class ResticRunner:
|
||||||
"""
|
"""
|
||||||
os.environ["RESTIC_PASSWORD"] = "o_O"
|
os.environ["RESTIC_PASSWORD"] = "o_O"
|
||||||
os.environ["RESTIC_REPOSITORY"] = (
|
os.environ["RESTIC_REPOSITORY"] = (
|
||||||
self.repository.split(":")[0] + ":_(o_O)_hidden_by_npbackup"
|
self.repository_anonymous
|
||||||
)
|
)
|
||||||
|
|
||||||
for env_variable in self.environment_variables.keys():
|
for env_variable in self.environment_variables.keys():
|
||||||
|
|
@ -261,6 +261,12 @@ class ResticRunner:
|
||||||
@property
|
@property
|
||||||
def executor_running(self) -> bool:
|
def executor_running(self) -> bool:
|
||||||
return self._executor_running
|
return self._executor_running
|
||||||
|
|
||||||
|
@property
|
||||||
|
def repository_anonymous(self):
|
||||||
|
if self.repository:
|
||||||
|
return self.repository.split(":")[0] + ":_(o_O)_hidden_by_npbackup"
|
||||||
|
return None
|
||||||
|
|
||||||
def write_logs(
|
def write_logs(
|
||||||
self,
|
self,
|
||||||
|
|
@ -627,7 +633,7 @@ class ResticRunner:
|
||||||
self.write_logs("Repository is not initialized or accessible", level="info")
|
self.write_logs("Repository is not initialized or accessible", level="info")
|
||||||
output = output.replace(
|
output = output.replace(
|
||||||
self.repository,
|
self.repository,
|
||||||
self.repository.split(":")[0] + ":_(o_O)_hidden_by_npbackup",
|
self.repository_anonymous,
|
||||||
)
|
)
|
||||||
return self._is_init, output
|
return self._is_init, output
|
||||||
|
|
||||||
|
|
@ -668,7 +674,7 @@ class ResticRunner:
|
||||||
# pylint: disable=E1101 (no-member)
|
# pylint: disable=E1101 (no-member)
|
||||||
output = output.replace(
|
output = output.replace(
|
||||||
self.repository,
|
self.repository,
|
||||||
self.repository.split(":")[0] + ":_(o_O)_hidden_by_npbackup",
|
self.repository_anonymous,
|
||||||
)
|
)
|
||||||
if (
|
if (
|
||||||
"repository is already locked" in output
|
"repository is already locked" in output
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue