From 956336da4bddb254a62d7dfd859a9c82dca566dd Mon Sep 17 00:00:00 2001 From: Illia Chub Date: Wed, 27 Oct 2021 12:24:46 +0300 Subject: [PATCH] Changed the way command passed to the Flask endpoint --- main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index fcfe060..aec9fd4 100755 --- a/main.py +++ b/main.py @@ -493,10 +493,12 @@ def ListAllBackups(): @app.route("/services/restic/backup/create", methods=["PUT"]) def CreateSingleBackup(): - backupProcessDescriptor = subprocess.Popen(["restic", "-r", "b2:" + - request.headers.get("X-Repository-Name") + ":/sfbackup", "--verbose", "backup", "/var", - "--password-file", "/var/lib/restic/rpass" - ]) + + backupCommand = ''' + restic -r b2:{}:/sfbackup --verbose backup /var --password-file /var/lib/restic/rpass + '''.format(request.headers.get("X-Repository-Name")) + + backupProcessDescriptor = subprocess.Popen(backupCommand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) backupProcessDescriptor.communicate()[0]