From c6e02effdf42aec698cb5b47e0a0cdd50eadf7cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 26 Apr 2024 23:52:06 +0200 Subject: [PATCH] Fix issue if services.yml don't exist --- scripts/_common.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 37d9197..2b3762c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -96,6 +96,8 @@ with open("/etc/yunohost/firewall.yml", "r") as f: if str(port) not in hard_coded_ports] with open("/etc/yunohost/services.yml", "r") as f: services = yaml.safe_load(f) + if services is None: + services = dict() port_map = dict() for key, value in services.items(): if 'needs_exposed_ports' in value: @@ -125,6 +127,8 @@ import yaml, socket hard_coded_ports = ["25", "53", "80", "443", "587", "993"] with open("/etc/yunohost/services.yml", "r") as f: services = yaml.safe_load(f) + if services is None: + services = dict() results = ["%s|%s" % (k, v["description"] if "description" in v else k) for k, v in services.items()] print('\n'.join(results)) EOF