mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge branch 'stretch-unstable' into autopep8
This commit is contained in:
commit
ba5c55e50d
3 changed files with 15 additions and 10 deletions
|
@ -183,7 +183,7 @@ def app_fetchlist(url=None, name=None):
|
||||||
with open(list_file, "w") as f:
|
with open(list_file, "w") as f:
|
||||||
f.write(appslist)
|
f.write(appslist)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise YunohostError("Error while writing appslist %s: %s" % (name, str(e)), __raw_msg__=True)
|
raise YunohostError("Error while writing appslist %s: %s" % (name, str(e)), raw_msg=True)
|
||||||
|
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
appslists[name]["lastUpdate"] = now
|
appslists[name]["lastUpdate"] = now
|
||||||
|
@ -839,9 +839,9 @@ def app_install(operation_logger, auth, app, label=None, args=None, no_remove_on
|
||||||
|
|
||||||
if install_retcode == -1:
|
if install_retcode == -1:
|
||||||
msg = m18n.n('operation_interrupted') + " " + error_msg
|
msg = m18n.n('operation_interrupted') + " " + error_msg
|
||||||
raise YunohostError(msg, __raw_msg__=True)
|
raise YunohostError(msg, raw_msg=True)
|
||||||
msg = error_msg
|
msg = error_msg
|
||||||
raise YunohostError(msg, __raw_msg__=True)
|
raise YunohostError(msg, raw_msg=True)
|
||||||
|
|
||||||
# Clean hooks and add new ones
|
# Clean hooks and add new ones
|
||||||
hook_remove(app_instance_name)
|
hook_remove(app_instance_name)
|
||||||
|
@ -1470,7 +1470,7 @@ def app_action_run(app, action, args=None):
|
||||||
actions = {x["id"]: x for x in actions}
|
actions = {x["id"]: x for x in actions}
|
||||||
|
|
||||||
if action not in actions:
|
if action not in actions:
|
||||||
raise YunohostError("action '%s' not available for app '%s', available actions are: %s" % (action, app, ", ".join(actions.keys())), __raw_msg__=True)
|
raise YunohostError("action '%s' not available for app '%s', available actions are: %s" % (action, app, ", ".join(actions.keys())), raw_msg=True)
|
||||||
|
|
||||||
action_declaration = actions[action]
|
action_declaration = actions[action]
|
||||||
|
|
||||||
|
@ -1508,7 +1508,7 @@ def app_action_run(app, action, args=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
if retcode not in action_declaration.get("accepted_return_codes", [0]):
|
if retcode not in action_declaration.get("accepted_return_codes", [0]):
|
||||||
raise YunohostError("Error while executing action '%s' of app '%s': return code %s" % (action, app, retcode), __raw_msg__=True)
|
raise YunohostError("Error while executing action '%s' of app '%s': return code %s" % (action, app, retcode), raw_msg=True)
|
||||||
|
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
|
||||||
|
@ -2428,7 +2428,7 @@ def _write_appslist_list(appslist_lists):
|
||||||
json.dump(appslist_lists, f)
|
json.dump(appslist_lists, f)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise YunohostError("Error while writing list of appslist %s: %s" %
|
raise YunohostError("Error while writing list of appslist %s: %s" %
|
||||||
(APPSLISTS_JSON, str(e)), __raw_msg__=True)
|
(APPSLISTS_JSON, str(e)), raw_msg=True)
|
||||||
|
|
||||||
|
|
||||||
def _register_new_appslist(url, name):
|
def _register_new_appslist(url, name):
|
||||||
|
|
|
@ -25,7 +25,12 @@ from moulinette import m18n
|
||||||
|
|
||||||
class YunohostError(MoulinetteError):
|
class YunohostError(MoulinetteError):
|
||||||
|
|
||||||
"""Yunohost base exception"""
|
"""
|
||||||
|
Yunohost base exception
|
||||||
|
|
||||||
|
The (only?) main difference with MoulinetteError being that keys
|
||||||
|
are translated via m18n.n (namespace) instead of m18n.g (global?)
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, key, __raw_msg__=False, *args, **kwargs):
|
def __init__(self, key, __raw_msg__=False, *args, **kwargs):
|
||||||
if __raw_msg__:
|
if __raw_msg__:
|
||||||
|
|
|
@ -13,14 +13,14 @@ def yunopaste(data):
|
||||||
try:
|
try:
|
||||||
r = requests.post("%s/documents" % paste_server, data=data, timeout=30)
|
r = requests.post("%s/documents" % paste_server, data=data, timeout=30)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise YunohostError("Something wrong happened while trying to paste data on paste.yunohost.org : %s" % str(e), __raw_msg__=True)
|
raise YunohostError("Something wrong happened while trying to paste data on paste.yunohost.org : %s" % str(e), raw_msg=True)
|
||||||
|
|
||||||
if r.status_code != 200:
|
if r.status_code != 200:
|
||||||
raise YunohostError("Something wrong happened while trying to paste data on paste.yunohost.org : %s, %s" % (r.status_code, r.text), __raw_msg__=True)
|
raise YunohostError("Something wrong happened while trying to paste data on paste.yunohost.org : %s, %s" % (r.status_code, r.text), raw_msg=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
url = json.loads(r.text)["key"]
|
url = json.loads(r.text)["key"]
|
||||||
except:
|
except:
|
||||||
raise YunohostError("Uhoh, couldn't parse the answer from paste.yunohost.org : %s" % r.text, __raw_msg__=True)
|
raise YunohostError("Uhoh, couldn't parse the answer from paste.yunohost.org : %s" % r.text, raw_msg=True)
|
||||||
|
|
||||||
return "%s/raw/%s" % (paste_server, url)
|
return "%s/raw/%s" % (paste_server, url)
|
||||||
|
|
Loading…
Add table
Reference in a new issue