fix(ls): catch error if there is no snapshot
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
a3f27fa6ba
commit
a3faa5d51f
11
backupbot.py
11
backupbot.py
|
@ -201,7 +201,18 @@ def list_files(snapshot, path):
|
|||
cmd.append(snapshot)
|
||||
if path:
|
||||
cmd.append(path)
|
||||
try:
|
||||
restic.cat.config()
|
||||
output = restic.internal.command_executor.execute(cmd)
|
||||
except ResticFailedError as error:
|
||||
if 'no snapshot found' in str(error):
|
||||
err_msg = f'There is no snapshot {snapshot}'
|
||||
if SERVICE:
|
||||
err_msg += f'for the app {SERVICE}'
|
||||
logging.error(err_msg)
|
||||
exit(1)
|
||||
else:
|
||||
raise error
|
||||
output = output.replace('}\n{', '}|{')
|
||||
results = list(map(json.loads, output.split('|')))
|
||||
return results
|
||||
|
|
Loading…
Reference in New Issue