Skip to content

Commit

Permalink
allow acmettol to not be present durinig initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
hpk42 committed Jul 8, 2024
1 parent 039ef7c commit 460041a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
5 changes: 2 additions & 3 deletions cmdeploy/src/cmdeploy/cmdeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ def dns_cmd_options(parser):


def dns_cmd(args, out):
"""Generate dns zone file."""
exit_code = show_dns(args, out)
exit(exit_code)
"""Check DNS entries and optionally generate dns zone file."""
show_dns(args, out)


def status_cmd(args, out):
Expand Down
15 changes: 10 additions & 5 deletions cmdeploy/src/cmdeploy/remote_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@

import re
import socket
from subprocess import check_output
from subprocess import CalledProcessError, check_output


def shell(command):
return check_output(command, shell=True).decode().rstrip()
def shell(command, fail_ok=False):
try:
return check_output(command, shell=True).decode().rstrip()
except CalledProcessError:
if not fail_ok:
raise
return ""


def get_systemd_running():
Expand All @@ -26,9 +31,9 @@ def get_systemd_running():
def perform_initial_checks(mail_domain):
res = {}

res["acme_account_url"] = shell("acmetool account-url")
res["acme_account_url"] = shell("acmetool account-url", fail_ok=True)
shell("apt-get install -y dnsutils")
shell("unbound-control flush_zone {mail_domain}")
shell("unbound-control flush_zone {mail_domain}", fail_ok=True)

res["dkim_entry"] = get_dkim_entry(mail_domain, dkim_selector="opendkim")

Expand Down

0 comments on commit 460041a

Please sign in to comment.