Strip out deleted VMs before passing them to shell scripts

This commit is contained in:
j3s 2020-05-20 18:37:53 -05:00
parent 773aa78ac4
commit e3f4de214c

View File

@ -44,6 +44,7 @@ def double_check_capsul_address(id, ipv4):
@account_required @account_required
def index(): def index():
vms = get_vms() vms = get_vms()
vms = list(filter(lambda x: not x['deleted'], vms))
created = request.args.get('created') created = request.args.get('created')
# this is here to prevent xss # this is here to prevent xss
@ -63,8 +64,7 @@ def index():
ipv4_status=("ok" if x['ipv4'] else "waiting-pulse"), ipv4_status=("ok" if x['ipv4'] else "waiting-pulse"),
os=x['os'], os=x['os'],
created=x['created'].strftime("%b %d %Y") created=x['created'].strftime("%b %d %Y")
), ), vms
list(filter(lambda x: not x['deleted'], vms))
)) ))
return render_template("capsuls.html", vms=vms, has_vms=len(vms) > 0, created=created) return render_template("capsuls.html", vms=vms, has_vms=len(vms) > 0, created=created)