Skip to content

Commit

Permalink
NAS-132612 / 25.04 / Remove stale locks before any TrueCloud Backup o…
Browse files Browse the repository at this point in the history
…peration (#15040)

* test

* eliminate a function call
  • Loading branch information
creatorcary authored Nov 25, 2024
1 parent ffb2512 commit 3b878a6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/middlewared/middlewared/plugins/cloud_backup/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,22 @@ def ensure_initialized(self, cloud_backup):
cloud_backup["credentials"]),
}

if self.is_initialized(cloud_backup):
restic_config = get_restic_config(cloud_backup)
subprocess.run(
restic_config.cmd + ["unlock"],
env=restic_config.env,
text=True
)

if self.is_initialized(restic_config):
return

self.init(cloud_backup)

@private
def is_initialized(self, cloud_backup):
def is_initialized(self, restic_config):
self.middleware.call_sync("network.general.will_perform_activity", "cloud_backup")

restic_config = get_restic_config(cloud_backup)

try:
subprocess.run(
restic_config.cmd + ["cat", "config"],
Expand Down

0 comments on commit 3b878a6

Please sign in to comment.