Update 'main.py'

pull/2/head
Illia Chub 2021-10-27 13:23:06 +03:00
parent f46e1ba134
commit 1bf4a779af
1 changed files with 6 additions and 4 deletions

10
main.py
View File

@ -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]