1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 04:36:48 +00:00

fix(console,computes): an unreachable host is named as the cause, not an empty list

The console page of a VM whose host does not answer said "Fail to get
console. Please check the console configuration of your VM." and logged
nothing. It now shows the connection error (to users who do not see the
hosts, that the host cannot be reached) and logs it with the VM and host.

A host's Storage, Networks, Interfaces, Filters and Secrets pages showed
the connection error and also "This host has no ...". The list is None
when it was not read, and the page shows only the error.
This commit is contained in:
catborise 2026-11-06 23:08:11 +03:00
parent 39dda65132
commit d1fb9bd2d4
14 changed files with 72 additions and 18 deletions

View file

@ -12,7 +12,7 @@
{% block content %}
{% include "computes/host_nav.html" with section="virtsecrets" %}
{% if not secrets_all %}
{% if secrets_all is None %}{# not read: the error above says why #}{% elif not secrets_all %}
<div class="alert alert-warning shadow-sm">
{% bs_icon 'exclamation-triangle' %} {% trans "This host has no secrets." %}
</div>

View file

@ -41,4 +41,4 @@ class SecretInUsePageTests(TestCase):
"ephemeral": False, "private": False}]
conn.return_value.get_users.side_effect = libvirt.libvirtError("connection reset")
response = self.client.get(self.url)
self.assertEqual(response.context["secrets_all"], [])
self.assertIsNone(response.context["secrets_all"])

View file

@ -19,7 +19,7 @@ def secrets(request, compute_id):
given a value or deleted, after which the list is read again. A value is
never shown or logged."""
compute = get_object_or_404(Compute, pk=compute_id)
secrets_all = []
secrets_all = None # not read: the page shows no list
try:
conn = wvmSecrets(compute.hostname, compute.login, compute.password, compute.type)