[enh] no cli option to avoid removing an application on installation failure

This commit is contained in:
Laurent Peuch 2016-10-09 21:34:03 +02:00
parent 2c0c53d06f
commit 81c19cd1d6
2 changed files with 18 additions and 13 deletions

View file

@ -436,6 +436,9 @@ app:
-a:
full: --args
help: Serialized arguments for app script (i.e. "domain=domain.tld&path=/path")
-n:
full: --no-remove-on-fail
help: Debug option to avoid removing the app on a filed installation
### app_remove() TODO: Write help
remove:

View file

@ -440,7 +440,7 @@ def app_upgrade(auth, app=[], url=None, file=None):
logger.success(m18n.n('upgrade_complete'))
def app_install(auth, app, label=None, args=None):
def app_install(auth, app, label=None, args=None, no_remove_on_fail=False):
"""
Install apps
@ -448,6 +448,7 @@ def app_install(auth, app, label=None, args=None):
app -- Name, local path or git URL of the app to install
label -- Custom name for the app
args -- Serialize arguments for app installation
no_remove_on_fail -- Debug option to avoid removing the app on a filed installation
"""
from yunohost.hook import hook_add, hook_remove, hook_exec
@ -541,6 +542,7 @@ def app_install(auth, app, label=None, args=None):
logger.exception(m18n.n('unexpected_error'))
finally:
if install_retcode != 0:
if not no_remove_on_fail:
# Setup environment for remove script
env_dict_remove = {}
env_dict_remove["YNH_APP_ID"] = app_id