mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Catch all exceptions while executing app install script
This commit is contained in:
parent
a0da8060f6
commit
81051f166b
1 changed files with 14 additions and 6 deletions
18
app.py
18
app.py
|
@ -482,16 +482,24 @@ def app_install(auth, app, label=None, args=None):
|
||||||
app_ssowatconf(auth)
|
app_ssowatconf(auth)
|
||||||
msignals.display(m18n.n('installation_complete'), 'success')
|
msignals.display(m18n.n('installation_complete'), 'success')
|
||||||
else:
|
else:
|
||||||
#TODO: display script fail messages
|
|
||||||
hook_remove(app_id)
|
|
||||||
shutil.rmtree(app_setting_path)
|
|
||||||
shutil.rmtree(app_tmp_folder)
|
|
||||||
raise MoulinetteError(errno.EIO, m18n.n('installation_failed'))
|
raise MoulinetteError(errno.EIO, m18n.n('installation_failed'))
|
||||||
except KeyboardInterrupt, EOFError:
|
except:
|
||||||
|
# Execute remove script and clean folders
|
||||||
hook_remove(app_id)
|
hook_remove(app_id)
|
||||||
shutil.rmtree(app_setting_path)
|
shutil.rmtree(app_setting_path)
|
||||||
shutil.rmtree(app_tmp_folder)
|
shutil.rmtree(app_tmp_folder)
|
||||||
|
|
||||||
|
# Reraise proper exception
|
||||||
|
try:
|
||||||
|
raise
|
||||||
|
except MoulinetteError:
|
||||||
|
raise
|
||||||
|
except KeyboardInterrupt, EOFError:
|
||||||
raise MoulinetteError(errno.EINTR, m18n.g('operation_interrupted'))
|
raise MoulinetteError(errno.EINTR, m18n.g('operation_interrupted'))
|
||||||
|
except Exception as e:
|
||||||
|
import traceback
|
||||||
|
msignals.display(traceback.format_exc(), 'log')
|
||||||
|
raise MoulinetteError(errno.EIO, m18n.n('installation_failed'))
|
||||||
|
|
||||||
|
|
||||||
def app_remove(auth, app):
|
def app_remove(auth, app):
|
||||||
|
|
Loading…
Add table
Reference in a new issue