Skip to content

Commit

Permalink
nixops backup-status: Give a proper error message if a backup doesn't…
Browse files Browse the repository at this point in the history
… exist

Previously we got: KeyError: '...'
  • Loading branch information
edolstra committed Nov 8, 2013
1 parent 26194d2 commit 44c3f39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/nixops
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,10 @@ def op_backup_status():
sorted_backups = sorted(backups.keys(), reverse=True)
if args.latest:
if len(backups) == 0:
Exception("no backups found!")
raise Exception("no backups found")
backupid = sorted_backups[0]

if backupid not in backups:
raise Exception("backup ID ‘{0}’ does not exist".format(backupid))
_backups = {}
_backups[backupid] = backups[backupid]
else:
Expand Down

0 comments on commit 44c3f39

Please sign in to comment.