fix wrong var name

This commit is contained in:
forest 2021-02-17 21:57:57 -06:00
parent 88905b944d
commit 70628039c4

View File

@ -69,7 +69,7 @@ def index():
mappedVms = [] mappedVms = []
for vm in vms: for vm in vms:
ip_display = x['ipv4'] ip_display = vm['ipv4']
if not ip_display: if not ip_display:
if vm["state"] == "running": if vm["state"] == "running":
ip_display = "..booting.." ip_display = "..booting.."
@ -77,20 +77,20 @@ def index():
ip_display = "unknown" ip_display = "unknown"
ip_display_class = "ok" ip_display_class = "ok"
if not x['ipv4']: if not vm['ipv4']:
if vm["state"] == "running": if vm["state"] == "running":
ip_display_class = "waiting-pulse" ip_display_class = "waiting-pulse"
else: else:
ip_display_class = "yellow" ip_display_class = "yellow"
mappedVms.append(dict( mappedVms.append(dict(
id=x['id'], id=vm['id'],
size=x['size'], size=vm['size'],
state=x['state'], state=vm['state'],
ipv4=ip_display, ipv4=ip_display,
ipv4_status=ip_display_class, ipv4_status=ip_display_class,
os=x['os'], os=vm['os'],
created=x['created'].strftime("%b %d %Y") created=vm['created'].strftime("%b %d %Y")
)) ))
return render_template("capsuls.html", vms=mappedVms, has_vms=len(vms) > 0, created=created) return render_template("capsuls.html", vms=mappedVms, has_vms=len(vms) > 0, created=created)