Add purge option to yunohost app remove

This commit is contained in:
sagessylu 2021-08-15 21:41:32 +02:00
parent 1e03057155
commit c2460d7526
No known key found for this signature in database
GPG key ID: 51F03D079983CCC7
2 changed files with 9 additions and 3 deletions

View file

@ -673,7 +673,11 @@ app:
api: DELETE /apps/<app> api: DELETE /apps/<app>
arguments: arguments:
app: app:
help: App to delete help: App to remove
-p:
full: --purge
help: Remove with all app data
action: store_true
### app_upgrade() ### app_upgrade()
upgrade: upgrade:

View file

@ -1187,12 +1187,13 @@ def dump_app_log_extract_for_debugging(operation_logger):
@is_unit_operation() @is_unit_operation()
def app_remove(operation_logger, app): def app_remove(operation_logger, app, purge=False):
""" """
Remove app Remove app
Keyword argument: Keyword arguments:
app -- App(s) to delete app -- App(s) to delete
purge -- Remove with all app data
""" """
from yunohost.hook import hook_exec, hook_remove, hook_callback from yunohost.hook import hook_exec, hook_remove, hook_callback
@ -1230,6 +1231,7 @@ def app_remove(operation_logger, app):
env_dict["YNH_APP_INSTANCE_NAME"] = app env_dict["YNH_APP_INSTANCE_NAME"] = app
env_dict["YNH_APP_INSTANCE_NUMBER"] = str(app_instance_nb) env_dict["YNH_APP_INSTANCE_NUMBER"] = str(app_instance_nb)
env_dict["YNH_APP_MANIFEST_VERSION"] = manifest.get("version", "?") env_dict["YNH_APP_MANIFEST_VERSION"] = manifest.get("version", "?")
env_dict["YNH_APP_PURGE"] = purge
operation_logger.extra.update({"env": env_dict}) operation_logger.extra.update({"env": env_dict})
operation_logger.flush() operation_logger.flush()