mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] removes status key from /etc/yunohost/service.yml for generic approach
This commit is contained in:
parent
cc240e94ca
commit
d32ab073ba
2 changed files with 23 additions and 20 deletions
|
@ -61,11 +61,17 @@ do_pre_regen() {
|
|||
_update_services() {
|
||||
sudo python2 - << EOF
|
||||
import yaml
|
||||
|
||||
|
||||
with open('services.yml') as f:
|
||||
new_services = yaml.load(f)
|
||||
|
||||
with open('/etc/yunohost/services.yml') as f:
|
||||
services = yaml.load(f)
|
||||
|
||||
updated = False
|
||||
|
||||
|
||||
for service, conf in new_services.items():
|
||||
# remove service with empty conf
|
||||
if conf is None:
|
||||
|
@ -73,20 +79,32 @@ for service, conf in new_services.items():
|
|||
print("removing '{0}' from services".format(service))
|
||||
del services[service]
|
||||
updated = True
|
||||
|
||||
# add new service
|
||||
elif not services.get(service, None):
|
||||
print("adding '{0}' to services".format(service))
|
||||
services[service] = conf
|
||||
updated = True
|
||||
|
||||
# update service conf
|
||||
else:
|
||||
conffiles = services[service].pop('conffiles', {})
|
||||
|
||||
# status need to be removed
|
||||
if "status" not in conf and "status" in services[service]:
|
||||
print("update '{0}' service status access".format(service))
|
||||
del services[service]["status"]
|
||||
updated = True
|
||||
|
||||
if services[service] != conf:
|
||||
print("update '{0}' service".format(service))
|
||||
services[service].update(conf)
|
||||
updated = True
|
||||
|
||||
if conffiles:
|
||||
services[service]['conffiles'] = conffiles
|
||||
|
||||
|
||||
if updated:
|
||||
with open('/etc/yunohost/services.yml-new', 'w') as f:
|
||||
yaml.safe_dump(services, f, default_flow_style=False)
|
||||
|
|
|
@ -1,57 +1,42 @@
|
|||
nginx:
|
||||
status: service
|
||||
log: /var/log/nginx
|
||||
avahi-daemon:
|
||||
status: service
|
||||
log: /var/log/daemon.log
|
||||
dnsmasq:
|
||||
status: service
|
||||
log: /var/log/daemon.log
|
||||
fail2ban:
|
||||
status: service
|
||||
log: /var/log/fail2ban.log
|
||||
dovecot:
|
||||
status: service
|
||||
log: [/var/log/mail.log,/var/log/mail.err]
|
||||
postfix:
|
||||
status: service
|
||||
log: [/var/log/mail.log,/var/log/mail.err]
|
||||
rmilter:
|
||||
status: systemctl status rmilter.service
|
||||
log: /var/log/mail.log
|
||||
rspamd:
|
||||
status: systemctl status rspamd.service
|
||||
log: /var/log/mail.log
|
||||
redis-server:
|
||||
status: service
|
||||
log: /var/log/redis/redis-server.log
|
||||
mysql:
|
||||
status: service
|
||||
log: [/var/log/mysql.log,/var/log/mysql.err]
|
||||
glances:
|
||||
status: service
|
||||
glances: {}
|
||||
ssh:
|
||||
status: service
|
||||
log: /var/log/auth.log
|
||||
ssl:
|
||||
status: null
|
||||
metronome:
|
||||
status: metronomectl status
|
||||
log: [/var/log/metronome/metronome.log,/var/log/metronome/metronome.err]
|
||||
slapd:
|
||||
status: service
|
||||
log: /var/log/syslog
|
||||
php5-fpm:
|
||||
status: service
|
||||
log: /var/log/php5-fpm.log
|
||||
yunohost-api:
|
||||
status: service
|
||||
log: /var/log/yunohost/yunohost-api.log
|
||||
yunohost-firewall:
|
||||
status: service
|
||||
need_lock: true
|
||||
nslcd:
|
||||
status: service
|
||||
log: /var/log/syslog
|
||||
nsswitch: {}
|
||||
nsswitch:
|
||||
status: null
|
||||
bind9: null
|
||||
tahoe-lafs: null
|
||||
memcached: null
|
||||
|
|
Loading…
Add table
Reference in a new issue