1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-18 18:07:22 +01:00

Fixed SIM105 (suppressible-exception)

This commit is contained in:
Teal Dulcet
2023-12-23 05:26:32 -08:00
committed by Joshua Tauberer
parent 6a47133e3f
commit f0377dd59e
4 changed files with 8 additions and 12 deletions

View File

@@ -11,6 +11,7 @@ import dns.resolver
from utils import shell, load_env_vars_from_file, safe_domain_name, sort_domains
from ssl_certificates import get_ssl_certificates, check_certificate
import contextlib
# From https://stackoverflow.com/questions/3026957/how-to-validate-a-domain-name-using-regex-php/16491074#16491074
# This regular expression matches domain names according to RFCs, it also accepts fqdn with an leading dot,
@@ -456,10 +457,8 @@ def build_sshfp_records():
for line in f:
s = line.rstrip().split()
if len(s) == 2 and s[0] == 'Port':
try:
with contextlib.suppress(ValueError):
port = int(s[1])
except ValueError:
pass
break
keys = shell("check_output", ["ssh-keyscan", "-4", "-t", "rsa,dsa,ecdsa,ed25519", "-p", str(port), "localhost"])