mirror of
https://github.com/YunoHost-Apps/monitorix_ynh.git
synced 2024-09-03 19:46:06 +02:00
Fix issue if services.yml don't exist
This commit is contained in:
parent
baa95866d4
commit
c6e02effdf
1 changed files with 4 additions and 0 deletions
|
@ -96,6 +96,8 @@ with open("/etc/yunohost/firewall.yml", "r") as f:
|
||||||
if str(port) not in hard_coded_ports]
|
if str(port) not in hard_coded_ports]
|
||||||
with open("/etc/yunohost/services.yml", "r") as f:
|
with open("/etc/yunohost/services.yml", "r") as f:
|
||||||
services = yaml.safe_load(f)
|
services = yaml.safe_load(f)
|
||||||
|
if services is None:
|
||||||
|
services = dict()
|
||||||
port_map = dict()
|
port_map = dict()
|
||||||
for key, value in services.items():
|
for key, value in services.items():
|
||||||
if 'needs_exposed_ports' in value:
|
if 'needs_exposed_ports' in value:
|
||||||
|
@ -125,6 +127,8 @@ import yaml, socket
|
||||||
hard_coded_ports = ["25", "53", "80", "443", "587", "993"]
|
hard_coded_ports = ["25", "53", "80", "443", "587", "993"]
|
||||||
with open("/etc/yunohost/services.yml", "r") as f:
|
with open("/etc/yunohost/services.yml", "r") as f:
|
||||||
services = yaml.safe_load(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()]
|
results = ["%s|%s" % (k, v["description"] if "description" in v else k) for k, v in services.items()]
|
||||||
print('\n'.join(results))
|
print('\n'.join(results))
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Reference in a new issue