From 3f72f23e811bedfef4c7a6cf6508719d8e866b46 Mon Sep 17 00:00:00 2001 From: captainwasabi Date: Sun, 11 Aug 2019 16:49:35 -0400 Subject: [PATCH 1/2] add proper check for DNS error in list_target_files The elif needed to check to see if the string was in the listing of results of the shell command. As it was the conditional was just the string which always evaluates to true and was therefore giving a misleading error message. --- management/backup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/management/backup.py b/management/backup.py index 93136bf5..cd1ee6fc 100755 --- a/management/backup.py +++ b/management/backup.py @@ -406,7 +406,7 @@ def list_target_files(config): reason = "Provided path {} is invalid.".format(target_path) elif 'Network is unreachable' in listing: reason = "The IP address {} is unreachable.".format(target.hostname) - elif 'Could not resolve hostname': + elif 'Could not resolve hostname' in listing: reason = "The hostname {} cannot be resolved.".format(target.hostname) else: reason = "Unknown error." \ From f7730031196b45a44c3dc2fe899f6cdff6c1ef8a Mon Sep 17 00:00:00 2001 From: captainwasabi Date: Mon, 12 Aug 2019 06:02:13 -0400 Subject: [PATCH 2/2] Save rsync settings before validating I understand the philosophy behind not saving until validated, but there are many examples in software where this is not true. For instance, setting up a mail account in Thunderbird or outlook. You can use the wrong settings on initial setup (indeed, outlook forces you to in some circumstances) then go repair them later. This also solves the second issue I raised in #1624 because running backup.py --validate will try to use the new settings, just like the Unkown Error case error message implies it should. --- management/backup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/management/backup.py b/management/backup.py index 93136bf5..8de37ba5 100755 --- a/management/backup.py +++ b/management/backup.py @@ -473,6 +473,8 @@ def backup_set_custom(env, target, target_user, target_pass, min_age): config["target_pass"] = target_pass config["min_age_in_days"] = min_age + write_backup_config(env, config) + # Validate. try: if config["target"] not in ("off", "local"): @@ -482,8 +484,6 @@ def backup_set_custom(env, target, target_user, target_pass, min_age): except ValueError as e: return str(e) - write_backup_config(env, config) - return "OK" def get_backup_config(env, for_save=False, for_ui=False):