diff --git a/management/backup.py b/management/backup.py index 3b6b75cf..93744d7d 100755 --- a/management/backup.py +++ b/management/backup.py @@ -581,7 +581,7 @@ def get_backup_config(env, for_save=False, for_ui=False): try: with open(os.path.join(backup_root, 'custom.yaml')) as f: custom_config = rtyaml.load(f) - if not isinstance(custom_config, dict): raise ValueError() # caught below + if not isinstance(custom_config, dict): raise ValueError # caught below config.update(custom_config) except: pass diff --git a/management/dns_update.py b/management/dns_update.py index 16a589c2..e911135f 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -817,7 +817,7 @@ def get_custom_dns_config(env, only_real_records=False): try: with open(os.path.join(env['STORAGE_ROOT'], 'dns/custom.yaml')) as f: custom_dns = rtyaml.load(f) - if not isinstance(custom_dns, dict): raise ValueError() # caught below + if not isinstance(custom_dns, dict): raise ValueError # caught below except: return [ ] @@ -835,7 +835,7 @@ def get_custom_dns_config(env, only_real_records=False): # No other type of data is allowed. else: - raise ValueError() + raise ValueError for rtype, value2 in values: if isinstance(value2, str): @@ -845,7 +845,7 @@ def get_custom_dns_config(env, only_real_records=False): yield (qname, rtype, value3) # No other type of data is allowed. else: - raise ValueError() + raise ValueError def filter_custom_records(domain, custom_dns_iter): for qname, rtype, value in custom_dns_iter: diff --git a/management/utils.py b/management/utils.py index 4ee100f1..f126f66b 100644 --- a/management/utils.py +++ b/management/utils.py @@ -38,7 +38,7 @@ def load_settings(env): try: with open(fn) as f: config = rtyaml.load(f) - if not isinstance(config, dict): raise ValueError() # caught below + if not isinstance(config, dict): raise ValueError # caught below return config except: return { } diff --git a/tests/fail2ban.py b/tests/fail2ban.py index bf002160..239eea23 100644 --- a/tests/fail2ban.py +++ b/tests/fail2ban.py @@ -33,7 +33,7 @@ def smtp_test(): server = smtplib.SMTP(hostname, 587) except ConnectionRefusedError: # looks like fail2ban worked - raise IsBlocked() + raise IsBlocked server.starttls() server.ehlo_or_helo_if_needed() @@ -58,7 +58,7 @@ def imap_test(): M = imaplib.IMAP4_SSL(hostname) except ConnectionRefusedError: # looks like fail2ban worked - raise IsBlocked() + raise IsBlocked try: M.login("fakeuser", "fakepassword") @@ -77,7 +77,7 @@ def pop_test(): M = poplib.POP3_SSL(hostname) except ConnectionRefusedError: # looks like fail2ban worked - raise IsBlocked() + raise IsBlocked try: M.user('fakeuser') try: @@ -102,7 +102,7 @@ def managesieve_test(): M = imaplib.IMAP4(hostname, 4190) except ConnectionRefusedError: # looks like fail2ban worked - raise IsBlocked() + raise IsBlocked try: M.login("fakeuser", "fakepassword") @@ -134,10 +134,10 @@ def http_test(url, expected_status, postdata=None, qsargs=None, auth=None): timeout=8, verify=False) # don't bother with HTTPS validation, it may not be configured yet except requests.exceptions.ConnectTimeout: - raise IsBlocked() + raise IsBlocked except requests.exceptions.ConnectionError as e: if "Connection refused" in str(e): - raise IsBlocked() + raise IsBlocked raise # some other unexpected condition # return response status code