X-Git-Url: http://gitweb.michael.orlitzky.com/?p=untangle-https-backup.git;a=blobdiff_plain;f=bin%2Funtangle-https-backup;h=3abb05f257741b96fd349c650b09c8c5db23932f;hp=1f6a2db3fcf671c27176aeff71d01f0fd52912cd;hb=HEAD;hpb=31baaa4a8ec5545be073bc6fc8ff3dd7a49d9707 diff --git a/bin/untangle-https-backup b/bin/untangle-https-backup index 1f6a2db..3abb05f 100755 --- a/bin/untangle-https-backup +++ b/bin/untangle-https-backup @@ -8,6 +8,7 @@ import configparser from http.client import HTTPException from os import chmod from urllib.error import HTTPError, URLError +from socket import timeout from sys import stderr from untangle.untangle import Untangle @@ -30,8 +31,10 @@ args = parser.parse_args() # Default to success, change it if anything fails. status = EXIT_OK -# Parse the configuration file... -config = configparser.ConfigParser() +# Parse the configuration file. In this contect "interpolation" is +# something completely berserk, and it breaks passwords containing '%' +# characters. So, we turn it off. +config = configparser.ConfigParser(interpolation=None) config.read(args.config_file) # And loop through each section. @@ -71,5 +74,12 @@ for section in config.sections(): msg = tpl.format(u.name, repr(e), u.host) print(msg, file=stderr) status = EXIT_BACKUPS_FAILED + except timeout as e: + # A socket.timeout exception occurs when something goes over + # the configured "timeout" limit. + tpl = '{:s}: socket timeout ({:s}) from {:s}' + msg = tpl.format(u.name, str(e), u.host) + print(msg, file=stderr) + status = EXIT_BACKUPS_FAILED exit(status)