docs: remove output paths from generated documentation

Otherwise, the `testRstOptions` test would fail too often!
This commit is contained in:
Antoine Eiche 2021-10-14 09:06:14 +02:00
parent fb85a3fe9e
commit 74bb227990
2 changed files with 31 additions and 24 deletions

View File

@ -489,7 +489,7 @@ For which domains should this account act as a catch all?
Note: Does not allow sending from all addresses of these domains.
- Type: ``list of one of s``
- Type: ``list of impossible (empty enum)s``
- Default: ``[]``
@ -858,23 +858,23 @@ check system $HOST
if loadavg (15min) > 70 for 8 cycles then alert
check process sshd with pidfile /var/run/sshd.pid
start program "/nix/store/gyg6zyw1f0d1ahh1yk0pl18sxwx5a3zc-systemd-246.6/bin/systemctl start sshd"
stop program "/nix/store/gyg6zyw1f0d1ahh1yk0pl18sxwx5a3zc-systemd-246.6/bin/systemctl stop sshd"
start program "<OUTPUT-PATH>/bin/systemctl start sshd"
stop program "<OUTPUT-PATH>/bin/systemctl stop sshd"
if failed port 22 protocol ssh for 2 cycles then restart
check process postfix with pidfile /var/lib/postfix/queue/pid/master.pid
start program = "/nix/store/gyg6zyw1f0d1ahh1yk0pl18sxwx5a3zc-systemd-246.6/bin/systemctl start postfix"
stop program = "/nix/store/gyg6zyw1f0d1ahh1yk0pl18sxwx5a3zc-systemd-246.6/bin/systemctl stop postfix"
start program = "<OUTPUT-PATH>/bin/systemctl start postfix"
stop program = "<OUTPUT-PATH>/bin/systemctl stop postfix"
if failed port 25 protocol smtp for 5 cycles then restart
check process dovecot with pidfile /var/run/dovecot2/master.pid
start program = "/nix/store/gyg6zyw1f0d1ahh1yk0pl18sxwx5a3zc-systemd-246.6/bin/systemctl start dovecot2"
stop program = "/nix/store/gyg6zyw1f0d1ahh1yk0pl18sxwx5a3zc-systemd-246.6/bin/systemctl stop dovecot2"
start program = "<OUTPUT-PATH>/bin/systemctl start dovecot2"
stop program = "<OUTPUT-PATH>/bin/systemctl stop dovecot2"
if failed host mx.example.com port 993 type tcpssl sslauto protocol imap for 5 cycles then restart
check process rspamd with pidfile /var/run/rspamd.pid
start program = "/nix/store/gyg6zyw1f0d1ahh1yk0pl18sxwx5a3zc-systemd-246.6/bin/systemctl start rspamd"
stop program = "/nix/store/gyg6zyw1f0d1ahh1yk0pl18sxwx5a3zc-systemd-246.6/bin/systemctl stop rspamd"
start program = "<OUTPUT-PATH>/bin/systemctl start rspamd"
stop program = "<OUTPUT-PATH>/bin/systemctl stop rspamd"
``

View File

@ -1,5 +1,6 @@
import json
import sys
import re
header = """
Mailserver Options
@ -23,7 +24,8 @@ template = """
f = open(sys.argv[1])
options = json.load(f)
options = { k: v for k, v in options.items() if k.startswith("mailserver.") }
options = {k: v for k, v in options.items()
if k.startswith("mailserver.")}
groups = ["mailserver.loginAccount",
"mailserver.certificate",
@ -34,21 +36,26 @@ groups = [ "mailserver.loginAccount",
"mailserver.backup",
"mailserver.borg"]
def print_option(name, value):
if 'default' in v:
if v['default'] == "":
if 'default' in value:
if value['default'] == "":
default = '- Default: ``""``'
else:
default = '- Default: ``{}``'.format(v['default'])
# Some default values contains OUTPUTPATHS which make the
# output not stable across nixpkgs updates.
default = re.sub('/nix/store/[\w.-]*/', '<OUTPUT-PATH>/', default) # noqa
else:
default = ""
print(template.format(
key=k,
line="-"*len(k),
description=v['description'],
type="- Type: ``{}``".format(v['type']),
key=name,
line="-"*len(name),
description=value['description'],
type="- Type: ``{}``".format(value['type']),
default=default))
print(header)
for k, v in options.items():
if any([k.startswith(c) for c in groups]):