🐛 Fix plugin install errors not being reported to the UI
When plugin install went async (4cf2a673c8) not all of the responses were caught. This PR changes the rest of the responses to become asynchronous as well.
Closes #3849
This commit is contained in:
1 parent
535af4aa1d
commit
b807eb2d6d
1 file changed
+36
-14
@@ -687,11 +687,19 @@ class PluginManagerPlugin(
|
||||
and not self._settings.get_boolean(["ignore_throttled"])
|
||||
):
|
||||
# currently throttled, we refuse to run
|
||||
return make_response(
|
||||
"System is currently throttled, refusing to install "
|
||||
"anything due to possible stability issues",
|
||||
409,
|
||||
error_msg = (
|
||||
"System is currently throttled, refusing to install anything"
|
||||
" due to possible stability isssues"
|
||||
)
|
||||
self._logger.error(error_msg)
|
||||
result = {
|
||||
"result": False,
|
||||
"source": source,
|
||||
"source_type": source_type,
|
||||
"reason": error_msg,
|
||||
}
|
||||
self._send_result_notification("install", result)
|
||||
return result
|
||||
|
||||
try:
|
||||
# Py3
|
||||
@@ -761,11 +769,20 @@ class PluginManagerPlugin(
|
||||
"Looks like the plugin was already installed. Forcing a reinstall."
|
||||
)
|
||||
force = True
|
||||
except Exception:
|
||||
self._logger.exception("Could not install plugin from %s" % source)
|
||||
return make_response(
|
||||
"Could not install plugin from URL, see the log for more details", 500
|
||||
)
|
||||
except Exception as e:
|
||||
self._logger.exception("Could not install plugin from {}".format(source))
|
||||
self._logger.exception("Reason: {}".format(repr(e)))
|
||||
result = {
|
||||
"result": False,
|
||||
"source": source,
|
||||
"source_type": source_type,
|
||||
"reason": "Could not install plugin from {}, see the log for more details".format(
|
||||
source
|
||||
),
|
||||
}
|
||||
self._send_result_notification("install", result)
|
||||
return result
|
||||
|
||||
else:
|
||||
if force:
|
||||
# We don't use --upgrade here because that will also happily update all our dependencies - we'd rather
|
||||
@@ -773,16 +790,21 @@ class PluginManagerPlugin(
|
||||
pip_args += ["--ignore-installed", "--force-reinstall", "--no-deps"]
|
||||
try:
|
||||
returncode, stdout, stderr = self._call_pip(pip_args)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
self._logger.exception(
|
||||
"Could not install plugin from {}".format(source)
|
||||
)
|
||||
return make_response(
|
||||
"Could not install plugin from source {}, see the log for more details".format(
|
||||
self._logger.exception("Reason: {}".format(repr(e)))
|
||||
result = {
|
||||
"result": False,
|
||||
"source": source,
|
||||
"source_type": source_type,
|
||||
"reason": "Could not install plugin from source {}, see the log for more details".format(
|
||||
source
|
||||
),
|
||||
500,
|
||||
)
|
||||
}
|
||||
self._send_result_notification("install", result)
|
||||
return result
|
||||
|
||||
try:
|
||||
result_line = list(
|
||||
|
||||
Reference in new issue
Block a user