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
13
backupbot.py
13
backupbot.py
|
@ -201,7 +201,18 @@ def list_files(snapshot, path):
|
||||||
cmd.append(snapshot)
|
cmd.append(snapshot)
|
||||||
if path:
|
if path:
|
||||||
cmd.append(path)
|
cmd.append(path)
|
||||||
output = restic.internal.command_executor.execute(cmd)
|
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{', '}|{')
|
output = output.replace('}\n{', '}|{')
|
||||||
results = list(map(json.loads, output.split('|')))
|
results = list(map(json.loads, output.split('|')))
|
||||||
return results
|
return results
|
||||||
|
|
Loading…
Reference in New Issue