yunohost.service: Show service name in messages

This commit is contained in:
Jerome Lebleu 2014-04-03 17:47:26 +02:00
parent 30d6ace802
commit c1f140b45f

View file

@ -43,11 +43,11 @@ def service_start(names):
names = [names] names = [names]
for name in names: for name in names:
if _run_service_command('start', name): if _run_service_command('start', name):
msignals.display(_("Service successfully started."), 'success') msignals.display(_("Service '%s' successfully started.") % name, 'success')
else: else:
if service_status(name)['status'] != 'running': if service_status(name)['status'] != 'running':
raise MoulinetteError(1, _("Starting of service '%s' failed") % name) raise MoulinetteError(1, _("Starting of service '%s' failed") % name)
msignals.display(_("Service already started.")) msignals.display(_("Service '%s' already started.") % name)
def service_stop(names): def service_stop(names):
@ -62,11 +62,11 @@ def service_stop(names):
names = [names] names = [names]
for name in names: for name in names:
if _run_service_command('stop', name): if _run_service_command('stop', name):
msignals.display(_("Service successfully stopped."), 'success') msignals.display(_("Service '%s' successfully stopped.") % name, 'success')
else: else:
if service_status(name)['status'] != 'inactive': if service_status(name)['status'] != 'inactive':
raise MoulinetteError(1, _("Stopping of service '%s' failed") % name) raise MoulinetteError(1, _("Stopping of service '%s' failed") % name)
msignals.display(_("Service already stopped.")) msignals.display(_("Service '%s' already stopped.") % name)
def service_enable(names): def service_enable(names):
@ -81,7 +81,7 @@ def service_enable(names):
names = [names] names = [names]
for name in names: for name in names:
if _run_service_command('enable', name): if _run_service_command('enable', name):
msignals.display(_("Service successfully enabled."), 'success') msignals.display(_("Service '%s' successfully enabled.") % name, 'success')
else: else:
raise MoulinetteError(1, _("Enabling of service '%s' failed") % name) raise MoulinetteError(1, _("Enabling of service '%s' failed") % name)
@ -98,7 +98,7 @@ def service_disable(names):
names = [names] names = [names]
for name in names: for name in names:
if _run_service_command('disable', name): if _run_service_command('disable', name):
msignals.display(_("Service successfully disabled."), 'success') msignals.display(_("Service '%s' successfully disabled.") % name, 'success')
else: else:
raise MoulinetteError(1, _("Disabling of service '%s' failed") % name) raise MoulinetteError(1, _("Disabling of service '%s' failed") % name)