From 6fea0a454f9c71185d24d2a2d0b22244e7f1d2d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 19 Jan 2024 16:44:13 +0100 Subject: [PATCH] Fix python code --- scripts/install | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index 5f2e057..7a98e38 100755 --- a/scripts/install +++ b/scripts/install @@ -68,11 +68,12 @@ ynh_script_progression --message="Adding a configuration file..." python3 -c ' import sys import yaml -print(yaml.dumps({ - "mails": sys.argv[1].split(","), - "sms_apis": sys.argv[2].split(","), - "monitored_servers": sys.argv[3].split(","), - "monitoring_servers": sys.argv[4].split(","), +split_or_empty = lambda x: [] if x == "" else x.split(",") +print(yaml.dump({ + "mails": split_or_empty(sys.argv[1]), + "sms_apis": split_or_empty(sys.argv[2]), + "monitored_servers": split_or_empty(sys.argv[3]), + "monitoring_servers": split_or_empty(sys.argv[4]), })) ' "$mails" "$sms_api" "$monitored_servers" "$monitoring_servers" \ > "$install_dir/conf/$app.yml"