summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Eiche <lewo@abesis.fr>2021-10-14 09:06:14 +0200
committerAntoine Eiche <lewo@abesis.fr>2021-10-14 09:06:14 +0200
commit74bb22799017b22b64fa4aa1a0ea46b8377d48e6 (patch)
tree7068d880ce1e8c2284733fe94e6b0bebc5d9db7e
parentfb85a3fe9e4f673f9c017a23ada00b05d61cdc6a (diff)
docs: remove output paths from generated documentation
Otherwise, the `testRstOptions` test would fail too often!
-rw-r--r--docs/options.rst18
-rw-r--r--scripts/generate-rst-options.py37
2 files changed, 31 insertions, 24 deletions
diff --git a/docs/options.rst b/docs/options.rst
index 33616d7..d198f5e 100644
--- a/docs/options.rst
+++ b/docs/options.rst
@@ -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"
``
diff --git a/scripts/generate-rst-options.py b/scripts/generate-rst-options.py
index da4e3dd..3a13074 100644
--- a/scripts/generate-rst-options.py
+++ b/scripts/generate-rst-options.py
@@ -1,5 +1,6 @@
import json
import sys
+import re
header = """
Mailserver Options
@@ -23,32 +24,38 @@ 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",
+ "mailserver.dkim",
+ "mailserver.fullTextSearch",
+ "mailserver.redis",
+ "mailserver.monitoring",
+ "mailserver.backup",
+ "mailserver.borg"]
-groups = [ "mailserver.loginAccount",
- "mailserver.certificate",
- "mailserver.dkim",
- "mailserver.fullTextSearch",
- "mailserver.redis",
- "mailserver.monitoring",
- "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]):