clean up and add email display to admin panel
This commit is contained in:
parent
57c62a7abc
commit
1e9043bbf2
@ -114,13 +114,13 @@ def index():
|
||||
|
||||
virt_vms_by_id = get_all_vms_from_hosts()
|
||||
|
||||
current_app.logger.info(pprint.pformat(db_vms_by_id))
|
||||
# current_app.logger.info(pprint.pformat(db_vms_by_id))
|
||||
|
||||
current_app.logger.info("\n\n\n\n")
|
||||
# current_app.logger.info("\n\n\n\n")
|
||||
|
||||
current_app.logger.info(pprint.pformat(virt_vms_by_id))
|
||||
# current_app.logger.info(pprint.pformat(virt_vms_by_id))
|
||||
|
||||
current_app.logger.info("\n\n\n\n")
|
||||
# current_app.logger.info("\n\n\n\n")
|
||||
|
||||
virt_vm_id_by_ipv4 = dict()
|
||||
for vm_id, virt_vm in virt_vms_by_id.items():
|
||||
|
@ -59,7 +59,7 @@ class DBModel:
|
||||
# ------ VM & ACCOUNT MANAGEMENT ---------
|
||||
|
||||
def non_deleted_vms_by_host_and_network(self, host_id):
|
||||
query = "SELECT id, desired_state, host, network_name, public_ipv4, public_ipv6 FROM vms WHERE deleted IS NULL"
|
||||
query = "SELECT id, email, desired_state, host, network_name, public_ipv4, public_ipv6 FROM vms WHERE deleted IS NULL"
|
||||
if host_id is None:
|
||||
self.cursor.execute(query)
|
||||
else:
|
||||
@ -73,15 +73,15 @@ class DBModel:
|
||||
|
||||
hosts = dict()
|
||||
for row in self.cursor.fetchall():
|
||||
host_id = row[2]
|
||||
network_name = row[3]
|
||||
host_id = row[3]
|
||||
network_name = row[4]
|
||||
if host_id not in hosts:
|
||||
hosts[host_id] = dict()
|
||||
if network_name not in hosts[host_id]:
|
||||
hosts[host_id][network_name] = []
|
||||
|
||||
hosts[host_id][network_name].append(
|
||||
dict(id=row[0], desired_state=row[1], public_ipv4=row[4], public_ipv6=row[5])
|
||||
dict(id=row[0], email=row[1], desired_state=row[2], public_ipv4=row[5], public_ipv6=row[6])
|
||||
)
|
||||
|
||||
return hosts
|
||||
|
@ -45,7 +45,7 @@
|
||||
</div>
|
||||
{% for vm in in_db_but_not_in_virt %}
|
||||
<div class="row">
|
||||
{{vm['id']}} {{vm['public_ipv4']}}
|
||||
{{vm['id']}} ({{vm['email']}}) {{vm['public_ipv4']}}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<hr/>
|
||||
@ -61,7 +61,7 @@
|
||||
</div>
|
||||
{% for vm in state_not_equal_to_desired_state %}
|
||||
<div class="row">
|
||||
<div>{{vm['id']}}: state={{vm['state']}} desired_state={{vm['desired_state']}}</div>
|
||||
<div>{{vm['id']}} ({{vm['email']}}): state={{vm['state']}} desired_state={{vm['desired_state']}}</div>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="set_state"></input>
|
||||
<input type="hidden" name="id" value="{{vm['id']}}"></input>
|
||||
@ -83,7 +83,7 @@
|
||||
</div>
|
||||
{% for vm in has_no_desired_ip_address %}
|
||||
<div class="row">
|
||||
{{vm['id']}}
|
||||
{{vm['id']}} ({{vm['email']}})
|
||||
</div>
|
||||
{% endfor %}
|
||||
<hr/>
|
||||
@ -98,7 +98,7 @@
|
||||
</div>
|
||||
{% for vm in has_not_aquired_ip_address_yet %}
|
||||
<div class="row">
|
||||
{{vm['id']}} desired_ipv4={{vm['public_ipv4']}}
|
||||
{{vm['id']}} ({{vm['email']}}) desired_ipv4={{vm['public_ipv4']}}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<hr/>
|
||||
@ -112,7 +112,7 @@
|
||||
</div>
|
||||
{% for vm in stole_someone_elses_ip_and_own_ip_avaliable %}
|
||||
<div class="row">
|
||||
<div>{{vm['id']}}: current_ipv4={{vm['current_ipv4']}} desired_ipv4={{vm['desired_ipv4']}}</div>
|
||||
<div>{{vm['id']}} ({{vm['email']}}): current_ipv4={{vm['current_ipv4']}} desired_ipv4={{vm['desired_ipv4']}}</div>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="dhcp_reset"></input>
|
||||
<input type="hidden" name="id" value="{{vm['id']}}"></input>
|
||||
@ -132,7 +132,7 @@
|
||||
</div>
|
||||
{% for vm in has_wrong_ip %}
|
||||
<div class="row">
|
||||
<div>{{vm['id']}}: current_ipv4={{vm['current_ipv4']}} desired_ipv4={{vm['desired_ipv4']}}</div>
|
||||
<div>{{vm['id']}} ({{vm['email']}}): current_ipv4={{vm['current_ipv4']}} desired_ipv4={{vm['desired_ipv4']}}</div>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="dhcp_reset"></input>
|
||||
<input type="hidden" name="id" value="{{vm['id']}}"></input>
|
||||
@ -153,7 +153,7 @@
|
||||
</div>
|
||||
{% for vm in stole_someone_elses_ip_but_own_ip_also_stolen %}
|
||||
<div class="row">
|
||||
<div>{{vm['id']}}: current_ipv4={{vm['current_ipv4']}} desired_ipv4={{vm['desired_ipv4']}}</div>
|
||||
<div>{{vm['id']}} ({{vm['email']}}): current_ipv4={{vm['current_ipv4']}} desired_ipv4={{vm['desired_ipv4']}}</div>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="stop_and_expire"></input>
|
||||
<input type="hidden" name="id" value="{{vm['id']}}"></input>
|
||||
|
Loading…
Reference in New Issue
Block a user