Merge pull request #59 from jeromelebleu/dev

Dev
This commit is contained in:
Alexis Gavoty 2013-12-19 07:29:23 -08:00
commit a4acb4ee69

View file

@ -80,9 +80,13 @@ def app_fetchlist(url=None, name=None):
else: else:
if name is None: raise YunoHostError(22, _("You must indicate a name for your custom list")) if name is None: raise YunoHostError(22, _("You must indicate a name for your custom list"))
if os.system('wget "'+ url +'" -O "'+ repo_path +'/'+ name +'.json"') != 0: list_file = repo_path +'/'+ name +'.json'
if os.system('wget "'+ url +'" -O "'+ list_file +'.tmp"') != 0:
raise YunoHostError(1, _("List server connection failed")) raise YunoHostError(1, _("List server connection failed"))
# Rename fetched temp list
os.rename(list_file +'.tmp', list_file)
os.system("touch /etc/cron.d/yunohost-applist-"+ name) os.system("touch /etc/cron.d/yunohost-applist-"+ name)
os.system("echo '00 00 * * * root yunohost app fetchlist -u "+ url +" -n "+ name +" --no-ldap >> /dev/null' >/etc/cron.d/yunohost-applist-"+ name) os.system("echo '00 00 * * * root yunohost app fetchlist -u "+ url +" -n "+ name +" --no-ldap >> /dev/null' >/etc/cron.d/yunohost-applist-"+ name)
@ -306,6 +310,10 @@ def app_upgrade(app, url=None, file=None):
else: else:
continue continue
# Check min version
if 'min_version' in manifest and __version__ < manifest['min_version']:
raise YunoHostError(1, app_id + _(" requires a more recent version of the moulinette"))
app_setting_path = apps_setting_path +'/'+ app_id app_setting_path = apps_setting_path +'/'+ app_id
if original_app_id != app_id: if original_app_id != app_id:
@ -380,6 +388,10 @@ def app_install(app, label=None, args=None):
else: else:
manifest = _extract_app_from_file(app) manifest = _extract_app_from_file(app)
# Check min version
if 'min_version' in manifest and __version__ < manifest['min_version']:
raise YunoHostError(1, _("App requires a more recent version of the moulinette"))
# Check ID # Check ID
if 'id' not in manifest or '__' in manifest['id']: if 'id' not in manifest or '__' in manifest['id']:
raise YunoHostError(22, _("App id is invalid")) raise YunoHostError(22, _("App id is invalid"))