don't rename import as link2xt prefers

This commit is contained in:
holger krekel
2024-09-02 18:25:34 +02:00
parent e32d81520a
commit 8d72d770a3
2 changed files with 4 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ All functions of this module
import re
from .rshell import ShellError, shell
from .rshell import CalledProcessError, shell
def perform_initial_checks(mail_domain):
@@ -44,7 +44,7 @@ def get_dkim_entry(mail_domain, dkim_selector):
f"openssl rsa -in /etc/dkimkeys/{dkim_selector}.private "
"-pubout 2>/dev/null | awk '/-/{next}{printf(\"%s\",$0)}'"
)
except ShellError:
except CalledProcessError:
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))

View File

@@ -1,12 +1,11 @@
from subprocess import CalledProcessError as ShellError
from subprocess import check_output
from subprocess import CalledProcessError, check_output
def shell(command, fail_ok=False):
print(f"$ {command}")
try:
return check_output(command, shell=True).decode().rstrip()
except ShellError:
except CalledProcessError:
if not fail_ok:
raise
return ""