test-conf -> test_conf, and test-status -> test_status

This commit is contained in:
Alexandre Aubin 2019-11-08 22:35:25 +01:00
parent a9dd701824
commit 5a68250322
2 changed files with 11 additions and 11 deletions

View file

@ -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

View file

@ -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)