fix: YNH_MAIN_DOMAINS env variable in regenconf

Also... `yunohost domain list --output-as plain` also print "#domain" and "#main"
so this used to create wierd files in /var/lib/metronome/
This commit is contained in:
Tagadda 2022-02-16 12:34:22 +00:00
parent ab0b66425c
commit a51738f1c3
2 changed files with 2 additions and 5 deletions

View file

@ -49,12 +49,8 @@ do_post_regen() {
# retrieve variables # retrieve variables
main_domain=$(cat /etc/yunohost/current_host) main_domain=$(cat /etc/yunohost/current_host)
# FIXME : small optimization to do to avoid calling a yunohost command ...
# maybe another env variable like YNH_MAIN_DOMAINS idk
domain_list=$(yunohost domain list --exclude-subdomains --output-as plain --quiet)
# create metronome directories for domains # create metronome directories for domains
for domain in $domain_list; do for domain in $YNH_MAIN_DOMAINS; do
mkdir -p "/var/lib/metronome/${domain//./%2e}/pep" mkdir -p "/var/lib/metronome/${domain//./%2e}/pep"
# http_upload directory must be writable by metronome and readable by nginx # http_upload directory must be writable by metronome and readable by nginx
mkdir -p "/var/xmpp-upload/${domain}/upload" mkdir -p "/var/xmpp-upload/${domain}/upload"

View file

@ -140,6 +140,7 @@ def regen_conf(
# though kinda tight-coupled to the postinstall logic :s # though kinda tight-coupled to the postinstall logic :s
if os.path.exists("/etc/yunohost/installed"): if os.path.exists("/etc/yunohost/installed"):
env["YNH_DOMAINS"] = " ".join(domain_list()["domains"]) env["YNH_DOMAINS"] = " ".join(domain_list()["domains"])
env["YNH_MAIN_DOMAINS"] = " ".join(domain_list(exclude_subdomains=True)["domains"])
pre_result = hook_callback("conf_regen", names, pre_callback=_pre_call, env=env) pre_result = hook_callback("conf_regen", names, pre_callback=_pre_call, env=env)