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

Fixed UP031 (printf-string-formatting): Use format specifiers instead of percent format

This commit is contained in:
Teal Dulcet
2023-12-22 07:19:06 -08:00
committed by Joshua Tauberer
parent 64540fbb44
commit 14a5613dc8
13 changed files with 67 additions and 76 deletions

View File

@@ -153,7 +153,7 @@ def restart_fail2ban_service(final=False):
if not final:
# Stop recidive jails during testing.
command += " && sudo fail2ban-client stop recidive"
os.system("%s \"%s\"" % (ssh_command, command))
os.system("{} \"{}\"".format(ssh_command, command))
def testfunc_runner(i, testfunc, *args):
print(i+1, end=" ", flush=True)

View File

@@ -98,7 +98,7 @@ else:
# And if that's OK, also check reverse DNS (the PTR record).
if not test_ptr("8.8.8.8", "Google Public DNS (Reverse DNS)"):
print ()
print ("The reverse DNS for %s is not correct. Consult your ISP for how to set the reverse DNS (also called the PTR record) for %s to %s." % (hostname, hostname, ipaddr))
print ("The reverse DNS for {} is not correct. Consult your ISP for how to set the reverse DNS (also called the PTR record) for {} to {}.".format(hostname, hostname, ipaddr))
sys.exit(1)
else:
print ("And the reverse DNS for the domain is correct.")

View File

@@ -6,11 +6,11 @@ if len(sys.argv) < 3:
sys.exit(1)
host, toaddr, fromaddr = sys.argv[1:4]
msg = """From: %s
To: %s
msg = """From: {}
To: {}
Subject: SMTP server test
This is a test message.""" % (fromaddr, toaddr)
This is a test message.""".format(fromaddr, toaddr)
server = smtplib.SMTP(host, 25)
server.set_debuglevel(1)