From 5a682503220bf4cf3a68684eb513fa2a4dbbcd94 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 8 Nov 2019 22:35:25 +0100 Subject: [PATCH] test-conf -> test_conf, and test-status -> test_status --- data/templates/yunohost/services.yml | 10 +++++----- src/yunohost/service.py | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/data/templates/yunohost/services.yml b/data/templates/yunohost/services.yml index 986beb271..351120a7d 100644 --- a/data/templates/yunohost/services.yml +++ b/data/templates/yunohost/services.yml @@ -1,6 +1,6 @@ nginx: log: /var/log/nginx - test-conf: nginx -t + test_conf: nginx -t needs_exposed_ports: [80, 443] avahi-daemon: log: /var/log/daemon.log @@ -13,7 +13,7 @@ dovecot: needs_exposed_ports: [993] postfix: log: [/var/log/mail.log,/var/log/mail.err] - test-status: systemctl show postfix@- | grep -q "^SubState=running" + test_status: systemctl show postfix@- | grep -q "^SubState=running" needs_exposed_ports: [25, 587] rspamd: log: /var/log/rspamd/rspamd.log @@ -24,7 +24,7 @@ mysql: alternates: ['mariadb'] ssh: log: /var/log/auth.log - test-conf: sshd -t + test_conf: sshd -t needs_exposed_ports: [22] metronome: log: [/var/log/metronome/metronome.log,/var/log/metronome/metronome.err] @@ -33,12 +33,12 @@ slapd: log: /var/log/syslog php7.0-fpm: log: /var/log/php7.0-fpm.log - test-conf: php-fpm7.0 --test + test_conf: php-fpm7.0 --test yunohost-api: log: /var/log/yunohost/yunohost-api.log yunohost-firewall: need_lock: true - test-status: iptables -S | grep "^-A INPUT" | grep " --dport" | grep -q ACCEPT + test_status: iptables -S | grep "^-A INPUT" | grep " --dport" | grep -q ACCEPT nslcd: log: /var/log/syslog glances: null diff --git a/src/yunohost/service.py b/src/yunohost/service.py index 850899ecc..612e73f6c 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -327,14 +327,14 @@ def service_status(names=[]): if "StateChangeTimestamp" in status: result[name]['last_state_change'] = datetime.utcfromtimestamp(status["StateChangeTimestamp"] / 1000000) - # 'test-status' is an optional field to test the status of the service using a custom command - if "test-status" in services[name]: - status = os.system(services[name]["test-status"]) + # 'test_status' is an optional field to test the status of the service using a custom command + if "test_status" in services[name]: + status = os.system(services[name]["test_status"]) result[name]["status"] = "running" if status == 0 else "failed" - # 'test-status' is an optional field to test the status of the service using a custom command - if "test-conf" in services[name]: - p = subprocess.Popen(services[name]["test-conf"], + # 'test_status' is an optional field to test the status of the service using a custom command + if "test_conf" in services[name]: + p = subprocess.Popen(services[name]["test_conf"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)