From eee43f5e113869c0d7972805172f14296556c6cc Mon Sep 17 00:00:00 2001 From: Jerome Lebleu Date: Thu, 19 Dec 2013 14:54:15 +0100 Subject: [PATCH] Download app list to a temp file --- yunohost_app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/yunohost_app.py b/yunohost_app.py index df742fa9..28a7af16 100644 --- a/yunohost_app.py +++ b/yunohost_app.py @@ -80,9 +80,13 @@ def app_fetchlist(url=None, name=None): else: 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")) + # Rename fetched temp list + os.rename(list_file +'.tmp', list_file) + 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)