diff --git a/chatmaild/src/chatmaild/migrate_db.py b/chatmaild/src/chatmaild/migrate_db.py index d616489c..92dd5528 100644 --- a/chatmaild/src/chatmaild/migrate_db.py +++ b/chatmaild/src/chatmaild/migrate_db.py @@ -32,7 +32,7 @@ def migrate_from_db_to_maildir(config, chunking=10000): # don't transfer special/CI accounts rows = [row for row in all_rows if row[0][:3] not in ("ci-", "ac_")] - logging.info(f"ignoring {len(all_rows)-len(rows)} CI accounts") + logging.info(f"ignoring {len(all_rows) - len(rows)} CI accounts") logging.info(f"migrating {len(rows)} sqlite database passwords to user dirs") for i, row in enumerate(rows): diff --git a/cmdeploy/src/cmdeploy/__init__.py b/cmdeploy/src/cmdeploy/__init__.py index df5bbaa2..b7169d71 100644 --- a/cmdeploy/src/cmdeploy/__init__.py +++ b/cmdeploy/src/cmdeploy/__init__.py @@ -10,7 +10,7 @@ from pathlib import Path from chatmaild.config import Config, read_config -from pyinfra import host, facts +from pyinfra import facts, host from pyinfra.facts.files import File from pyinfra.facts.systemd import SystemdEnabled from pyinfra.operations import apt, files, pip, server, systemd @@ -517,9 +517,9 @@ def deploy_iroh_relay(config) -> None: need_restart |= systemd_unit.changed iroh_config = files.put( - name=f"Upload iroh-relay config", + name="Upload iroh-relay config", src=importlib.resources.files(__package__).joinpath("iroh-relay.toml"), - dest=f"/etc/iroh-relay.toml", + dest="/etc/iroh-relay.toml", user="root", group="root", mode="644", diff --git a/cmdeploy/src/cmdeploy/acmetool/__init__.py b/cmdeploy/src/cmdeploy/acmetool/__init__.py index 4e47d46e..19a37955 100644 --- a/cmdeploy/src/cmdeploy/acmetool/__init__.py +++ b/cmdeploy/src/cmdeploy/acmetool/__init__.py @@ -70,6 +70,6 @@ def deploy_acmetool(email="", domains=[]): ) server.shell( - name=f"Request certificate for: { ', '.join(domains) }", - commands=[f"acmetool want --xlog.severity=debug { ' '.join(domains)}"], + name=f"Request certificate for: {', '.join(domains)}", + commands=[f"acmetool want --xlog.severity=debug {' '.join(domains)}"], ) diff --git a/cmdeploy/src/cmdeploy/cmdeploy.py b/cmdeploy/src/cmdeploy/cmdeploy.py index b36b29f0..3904e1d5 100644 --- a/cmdeploy/src/cmdeploy/cmdeploy.py +++ b/cmdeploy/src/cmdeploy/cmdeploy.py @@ -56,12 +56,12 @@ def run_cmd_options(parser): "--disable-mail", dest="disable_mail", action="store_true", - help="install/upgrade the server, but disable postfix & dovecot for now" + help="install/upgrade the server, but disable postfix & dovecot for now", ) parser.add_argument( "--ssh-host", dest="ssh_host", - help="specify an SSH host to deploy to; uses mail_domain from chatmail.ini by default" + help="specify an SSH host to deploy to; uses mail_domain from chatmail.ini by default", ) diff --git a/cmdeploy/src/cmdeploy/deploy.py b/cmdeploy/src/cmdeploy/deploy.py index 0ea153d7..bb59daa2 100644 --- a/cmdeploy/src/cmdeploy/deploy.py +++ b/cmdeploy/src/cmdeploy/deploy.py @@ -11,7 +11,7 @@ def main(): "CHATMAIL_INI", importlib.resources.files("cmdeploy").joinpath("../../../chatmail.ini"), ) - disable_mail = bool(os.environ.get('CHATMAIL_DISABLE_MAIL')) + disable_mail = bool(os.environ.get("CHATMAIL_DISABLE_MAIL")) deploy_chatmail(config_path, disable_mail) diff --git a/cmdeploy/src/cmdeploy/dns.py b/cmdeploy/src/cmdeploy/dns.py index dc5bb722..17456fd7 100644 --- a/cmdeploy/src/cmdeploy/dns.py +++ b/cmdeploy/src/cmdeploy/dns.py @@ -57,7 +57,9 @@ def check_full_zone(sshexec, remote_data, out, zonefile) -> int: out("") returncode = 1 if remote_data.get("dkim_entry") in required_diff: - out("If the DKIM entry above does not work with your DNS provider, you can try this one:\n") + out( + "If the DKIM entry above does not work with your DNS provider, you can try this one:\n" + ) out(remote_data.get("web_dkim_entry") + "\n") if recommended_diff: out("WARNING: these recommended DNS entries are not set:\n") diff --git a/cmdeploy/src/cmdeploy/remote/rdns.py b/cmdeploy/src/cmdeploy/remote/rdns.py index f3b91278..317fa51b 100644 --- a/cmdeploy/src/cmdeploy/remote/rdns.py +++ b/cmdeploy/src/cmdeploy/remote/rdns.py @@ -27,7 +27,9 @@ def perform_initial_checks(mail_domain): res = dict(mail_domain=mail_domain, A=A, AAAA=AAAA, MTA_STS=MTA_STS, WWW=WWW) res["acme_account_url"] = shell("acmetool account-url", fail_ok=True) - res["dkim_entry"], res["web_dkim_entry"] = get_dkim_entry(mail_domain, dkim_selector="opendkim") + res["dkim_entry"], res["web_dkim_entry"] = get_dkim_entry( + mail_domain, dkim_selector="opendkim" + ) if not MTA_STS or not WWW or (not A and not AAAA): return res @@ -48,7 +50,7 @@ def get_dkim_entry(mail_domain, dkim_selector): return dkim_value_raw = f"v=DKIM1;k=rsa;p={dkim_pubkey};s=email;t=s" dkim_value = '" "'.join(re.findall(".{1,255}", dkim_value_raw)) - web_dkim_value = ''.join(re.findall(".{1,255}", dkim_value_raw)) + web_dkim_value = "".join(re.findall(".{1,255}", dkim_value_raw)) return ( f'{dkim_selector}._domainkey.{mail_domain}. TXT "{dkim_value}"', f'{dkim_selector}._domainkey.{mail_domain}. TXT "{web_dkim_value}"', diff --git a/cmdeploy/src/cmdeploy/tests/online/test_2_deltachat.py b/cmdeploy/src/cmdeploy/tests/online/test_2_deltachat.py index a75ab28c..466dae7b 100644 --- a/cmdeploy/src/cmdeploy/tests/online/test_2_deltachat.py +++ b/cmdeploy/src/cmdeploy/tests/online/test_2_deltachat.py @@ -85,7 +85,7 @@ def parse_size_limit(limit: str) -> int: attachsize = 1 * 1024 * 1024 num_to_send = quota // attachsize + 2 lp.sec(f"ac1: send {num_to_send} large files to ac2") - lp.indent(f"per-user quota is assumed to be: {quota/(1024*1024)}MB") + lp.indent(f"per-user quota is assumed to be: {quota / (1024 * 1024)}MB") alphanumeric = "abcdefghijklmnopqrstuvwxyz1234567890" msgs = [] for i in range(num_to_send): @@ -97,7 +97,7 @@ def parse_size_limit(limit: str) -> int: msg = chat.send_file(str(attachment)) msgs.append(msg) - lp.indent(f"Sent out msg {i}, size {attachsize/(1024*1024)}MB") + lp.indent(f"Sent out msg {i}, size {attachsize / (1024 * 1024)}MB") lp.sec("ac2: check messages are arriving until quota is reached")