Add app_manifest to fetch manifest of an app from the catalog or using url

This commit is contained in:
Alexandre Aubin 2021-04-16 00:32:25 +02:00
parent 02a30125b5
commit 9adf5e522c
2 changed files with 24 additions and 1 deletions

View file

@ -608,6 +608,14 @@ app:
string: string:
help: Return matching app name or description with "string" help: Return matching app name or description with "string"
### app_manifest()
manifest:
action_help: Return the manifest of a given app from the manifest, or from a remote git repo
api: GET /apps/manifest
arguments:
app:
help: Name, local path or git URL of the app to fetch the manifest of
fetchlist: fetchlist:
deprecated: true deprecated: true
@ -679,7 +687,7 @@ app:
help: Do not ask confirmation if the app is not safe to use (low quality, experimental or 3rd party) help: Do not ask confirmation if the app is not safe to use (low quality, experimental or 3rd party)
action: store_true action: store_true
### app_remove() TODO: Write help ### app_remove()
remove: remove:
action_help: Remove app action_help: Remove app
api: DELETE /apps/<app> api: DELETE /apps/<app>

View file

@ -786,6 +786,21 @@ def app_upgrade(app=[], url=None, file=None, force=False):
logger.success(m18n.n("upgrade_complete")) logger.success(m18n.n("upgrade_complete"))
def app_manifest(app):
raw_app_list = _load_apps_catalog()["apps"]
if app in raw_app_list or ("@" in app) or ("http://" in app) or ("https://" in app):
manifest, extracted_app_folder = _fetch_app_from_git(app)
elif os.path.exists(app):
manifest, extracted_app_folder = _extract_app_from_file(app)
else:
raise YunohostValidationError("app_unknown")
shutil.rmtree(extracted_app_folder)
return manifest
@is_unit_operation() @is_unit_operation()
def app_install( def app_install(
operation_logger, operation_logger,