prevent keyError when double_check_capsul_address returns None

This commit is contained in:
forest 2021-02-17 20:56:52 -06:00
parent ba0b29462c
commit fd5d23cf22
2 changed files with 5 additions and 0 deletions

View File

@ -63,6 +63,9 @@ def index():
if result is not None: if result is not None:
vm["ipv4"] = result.ipv4 vm["ipv4"] = result.ipv4
vm["state"] = result.state vm["state"] = result.state
else:
vm["state"] = "unknown"
vms = list(map( vms = list(map(
lambda x: dict( lambda x: dict(

View File

@ -38,6 +38,8 @@
<td class="capsul-status waiting-pulse"></td> <td class="capsul-status waiting-pulse"></td>
{% elif vm['state'] == 'crashed' or vm['state'] == 'blocked' or vm['state'] == 'stopped' %} {% elif vm['state'] == 'crashed' or vm['state'] == 'blocked' or vm['state'] == 'stopped' %}
<td class="capsul-status red"></td> <td class="capsul-status red"></td>
{% elif vm['state'] == 'unknown' %}
<td class="capsul-status">?</td>
{% else %} {% else %}
<td class="capsul-status green"></td> <td class="capsul-status green"></td>
{% endif %} {% endif %}