mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Prevent non-updated multi-instances apps installation (close #126)
This commit is contained in:
parent
7a87fa7ebc
commit
aca251e981
2 changed files with 15 additions and 1 deletions
|
@ -34,6 +34,8 @@
|
||||||
"app_extraction_failed" : "Unable to extract installation files",
|
"app_extraction_failed" : "Unable to extract installation files",
|
||||||
"app_install_files_invalid" : "Invalid installation files",
|
"app_install_files_invalid" : "Invalid installation files",
|
||||||
"app_manifest_invalid" : "Invalid app manifest",
|
"app_manifest_invalid" : "Invalid app manifest",
|
||||||
|
"app_incompatible" : "The app is incompatible with your YunoHost version",
|
||||||
|
"app_package_need_update" : "The app package need to be updated to follow YunoHost changes",
|
||||||
"app_argument_choice_invalid" : "Invalid choice for argument '{name:s}', it must be one of {choices:s}",
|
"app_argument_choice_invalid" : "Invalid choice for argument '{name:s}', it must be one of {choices:s}",
|
||||||
"app_argument_invalid" : "Invalid value for argument '{name:s}': {error:s}",
|
"app_argument_invalid" : "Invalid value for argument '{name:s}': {error:s}",
|
||||||
"app_argument_required" : "Argument '{name:s}' is required",
|
"app_argument_required" : "Argument '{name:s}' is required",
|
||||||
|
|
|
@ -1385,12 +1385,24 @@ def _encode_string(value):
|
||||||
def _check_manifest_requirements(manifest):
|
def _check_manifest_requirements(manifest):
|
||||||
"""Check if required packages are met from the manifest"""
|
"""Check if required packages are met from the manifest"""
|
||||||
requirements = manifest.get('requirements', dict())
|
requirements = manifest.get('requirements', dict())
|
||||||
|
|
||||||
# FIXME: Deprecate min_version key
|
# FIXME: Deprecate min_version key
|
||||||
if 'min_version' in manifest:
|
if 'min_version' in manifest:
|
||||||
requirements['yunohost'] = '>> {0}'.format(manifest['min_version'])
|
requirements['yunohost'] = '>> {0}'.format(manifest['min_version'])
|
||||||
logger.debug("the manifest key 'min_version' is deprecated, "
|
logger.debug("the manifest key 'min_version' is deprecated, "
|
||||||
"use 'requirements' instead.")
|
"use 'requirements' instead.")
|
||||||
if not requirements:
|
|
||||||
|
# Validate multi-instance app
|
||||||
|
if manifest.get('multi_instance', False):
|
||||||
|
# Handle backward-incompatible change introduced in yunohost >= 2.3.6
|
||||||
|
# See https://dev.yunohost.org/issues/156
|
||||||
|
yunohost_req = requirements.get('yunohost', None)
|
||||||
|
if (not yunohost_req or
|
||||||
|
not packages.SpecifierSet(yunohost_req) & '>= 2.3.6'):
|
||||||
|
raise MoulinetteError(errno.EINVAL, '{0}{1}'.format(
|
||||||
|
m18n.g('colon', m18n.n('app_incompatible')),
|
||||||
|
m18n.n('app_package_need_update')))
|
||||||
|
elif not requirements:
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.info(m18n.n('app_requirements_checking'))
|
logger.info(m18n.n('app_requirements_checking'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue