From 848dea83ab85b1f9e68157b74b39f1ed66590853 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Wed, 12 Aug 2015 11:19:59 +0000 Subject: [PATCH] additional error handling for backups with an invalid target --- management/backup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/management/backup.py b/management/backup.py index d7113799..4559505c 100755 --- a/management/backup.py +++ b/management/backup.py @@ -53,7 +53,7 @@ def backup_status(env): "size": 0, # collection-status doesn't give us the size "volumes": keys[2], # number of archive volumes for this backup (not really helpful) } - collection_status = shell('check_output', [ + code, collection_status = shell('check_output', [ "/usr/bin/duplicity", "collection-status", "--archive-dir", backup_cache_dir, @@ -61,7 +61,12 @@ def backup_status(env): "--log-fd", "1", config["target"], ], - get_env(env)) + get_env(env), + trap=True) + if code != 0: + # Command failed. This is likely due to an improperly configured remote + # destination for the backups. + return { } for line in collection_status.split('\n'): if line.startswith(" full") or line.startswith(" inc"): backup = parse_line(line)