mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Allow to add a service description on "yunohost service add" (#529)
* [enh] add a service description with YML file * moins "espace"
This commit is contained in:
parent
8b8d4cc19a
commit
e56616af5e
2 changed files with 12 additions and 2 deletions
|
@ -1136,6 +1136,9 @@ service:
|
|||
full: --runlevel
|
||||
help: Runlevel priority of the service
|
||||
type: int
|
||||
-d:
|
||||
full: --description
|
||||
help: Description of the service
|
||||
|
||||
### service_remove()
|
||||
remove:
|
||||
|
|
|
@ -50,7 +50,7 @@ MOULINETTE_LOCK = "/var/run/moulinette_yunohost.lock"
|
|||
logger = log.getActionLogger('yunohost.service')
|
||||
|
||||
|
||||
def service_add(name, status=None, log=None, runlevel=None):
|
||||
def service_add(name, status=None, log=None, runlevel=None, description=None):
|
||||
"""
|
||||
Add a custom service
|
||||
|
||||
|
@ -59,6 +59,7 @@ def service_add(name, status=None, log=None, runlevel=None):
|
|||
status -- Custom status command
|
||||
log -- Absolute path to log file to display
|
||||
runlevel -- Runlevel priority of the service
|
||||
description -- description of the service
|
||||
|
||||
"""
|
||||
services = _get_services()
|
||||
|
@ -74,6 +75,9 @@ def service_add(name, status=None, log=None, runlevel=None):
|
|||
if runlevel is not None:
|
||||
services[name]['runlevel'] = runlevel
|
||||
|
||||
if description is not None:
|
||||
services[name]['description'] = description
|
||||
|
||||
try:
|
||||
_save_services(services)
|
||||
except:
|
||||
|
@ -251,7 +255,10 @@ def service_status(names=[]):
|
|||
|
||||
else:
|
||||
translation_key = "service_description_%s" % name
|
||||
description = m18n.n(translation_key)
|
||||
if "description" in services[name] is not None:
|
||||
description = services[name].get("description")
|
||||
else:
|
||||
description = m18n.n(translation_key)
|
||||
|
||||
# that mean that we don't have a translation for this string
|
||||
# that's the only way to test for that for now
|
||||
|
|
Loading…
Add table
Reference in a new issue