mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Add option '--need-lock' to 'yunohost service add' (#530)
* [enh] Add option '--need-lock' * corection typo * correction merge
This commit is contained in:
parent
c3d8da7f07
commit
95827438c5
2 changed files with 9 additions and 2 deletions
|
@ -1136,6 +1136,10 @@ service:
|
|||
full: --runlevel
|
||||
help: Runlevel priority of the service
|
||||
type: int
|
||||
-n:
|
||||
full: --need_lock
|
||||
help: Use this option to prevent deadlocks if the service does invoke yunohost commands.
|
||||
action: store_true
|
||||
-d:
|
||||
full: --description
|
||||
help: Description of the service
|
||||
|
|
|
@ -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, description=None):
|
||||
def service_add(name, status=None, log=None, runlevel=None, need_lock=False, description=None):
|
||||
"""
|
||||
Add a custom service
|
||||
|
||||
|
@ -59,8 +59,8 @@ def service_add(name, status=None, log=None, runlevel=None, description=None):
|
|||
status -- Custom status command
|
||||
log -- Absolute path to log file to display
|
||||
runlevel -- Runlevel priority of the service
|
||||
need_lock -- Use this option to prevent deadlocks if the service does invoke yunohost commands.
|
||||
description -- description of the service
|
||||
|
||||
"""
|
||||
services = _get_services()
|
||||
|
||||
|
@ -75,6 +75,9 @@ def service_add(name, status=None, log=None, runlevel=None, description=None):
|
|||
if runlevel is not None:
|
||||
services[name]['runlevel'] = runlevel
|
||||
|
||||
if need_lock:
|
||||
services[name]['need_lock'] = True
|
||||
|
||||
if description is not None:
|
||||
services[name]['description'] = description
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue