[mod] Use systemctl for all service operations

This commit is contained in:
Alexandre Aubin 2017-11-27 23:12:13 +01:00
parent fd23216544
commit 164377d599

View file

@ -498,11 +498,8 @@ def _run_service_command(action, service):
raise MoulinetteError(errno.EINVAL, m18n.n('service_unknown', service=service)) raise MoulinetteError(errno.EINVAL, m18n.n('service_unknown', service=service))
cmd = None cmd = None
if action in ['start', 'stop', 'restart', 'reload']: if action in ['start', 'stop', 'restart', 'reload', 'enable', 'disable']:
cmd = 'service %s %s' % (service, action) cmd = 'systemctl %s %s' % (action, service)
elif action in ['enable', 'disable']:
arg = 'defaults' if action == 'enable' else 'remove'
cmd = 'update-rc.d %s %s' % (service, arg)
else: else:
raise ValueError("Unknown action '%s'" % action) raise ValueError("Unknown action '%s'" % action)