From 1bf4a779aff804422ebae7b11ceacb90e69ce2ba Mon Sep 17 00:00:00 2001 From: Illia Chub Date: Wed, 27 Oct 2021 13:23:06 +0300 Subject: [PATCH] Update 'main.py' --- main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 352bfb9..9631e67 100755 --- a/main.py +++ b/main.py @@ -478,10 +478,12 @@ def EnableOcserv(): @app.route("/services/restic/backup/list", methods=["GET"]) def ListAllBackups(): - backupListingProcessDescriptor = subprocess.Popen(["restic", "-r", "b2:" + - request.headers.get("X-Repository-Name") + ":/sfbackup", - "snapshots", "list", "--password-file", "/var/lib/restic/rpass", "--json" - ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + + backupListingCommand = ''' + restic -r b2:{0}:/sfbackup snapshots list --password-file /var/lib/restic/rpass --json + '''.format(request.headers.get("X-Repository-Name")) + + backupListingProcessDescriptor = subprocess.Popen(backupListingCommand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) snapshotsList = backupListingProcessDescriptor.communicate()[0]