mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] simplify code, give more verbose debug output
This commit is contained in:
parent
1fab47cbea
commit
7435cfdea3
1 changed files with 5 additions and 5 deletions
|
@ -511,11 +511,11 @@ def _run_service_command(action, service):
|
|||
if service not in services.keys():
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n('service_unknown', service=service))
|
||||
|
||||
cmd = None
|
||||
if action in ['start', 'stop', 'restart', 'reload', 'enable', 'disable']:
|
||||
cmd = 'systemctl %s %s' % (action, service)
|
||||
else:
|
||||
raise ValueError("Unknown action '%s'" % action)
|
||||
possible_actions = ['start', 'stop', 'restart', 'reload', 'enable', 'disable']
|
||||
if action not in possible_actions:
|
||||
raise ValueError("Unknown action '%s', available actions are: %s" % (action, ", ".join(possible_actions)))
|
||||
|
||||
cmd = 'systemctl %s %s' % (action, service)
|
||||
|
||||
need_lock = services[service].get('need_lock', False) \
|
||||
and action in ['start', 'stop', 'restart', 'reload']
|
||||
|
|
Loading…
Add table
Reference in a new issue