mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-26 18:56:35 +00:00
fix: check if repo is initted by checking retcode
This commit is contained in:
parent
ff70a3588e
commit
52336b885d
|
@ -228,8 +228,7 @@ class ResticBackupper(AbstractBackupper):
|
||||||
|
|
||||||
def is_initted(self) -> bool:
|
def is_initted(self) -> bool:
|
||||||
command = self.restic_command(
|
command = self.restic_command(
|
||||||
"check",
|
"unlock",
|
||||||
"--json",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
with subprocess.Popen(
|
with subprocess.Popen(
|
||||||
|
@ -237,10 +236,8 @@ class ResticBackupper(AbstractBackupper):
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
shell=False,
|
shell=False,
|
||||||
) as handle:
|
) as handle:
|
||||||
output = handle.communicate()[0].decode("utf-8")
|
if handle.returncode != 0:
|
||||||
if not ResticBackupper.has_json(output):
|
|
||||||
return False
|
return False
|
||||||
# raise NotImplementedError("error(big): " + output)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def restored_size(self, snapshot_id: str) -> int:
|
def restored_size(self, snapshot_id: str) -> int:
|
||||||
|
|
Loading…
Reference in a new issue