status in list deployments in admin panel

This commit is contained in:
deflax 2018-04-07 16:41:02 +03:00
parent c3ab881841
commit dfbd38d1e7
3 changed files with 5 additions and 7 deletions

View file

@ -53,13 +53,11 @@ def list_deployments():
'type': 'kvm' }
try:
query = contact_proxmaster(data, 'status')
status = { int(deploy.machine_id): str(query) }
status = { int(deploy.machine_id): str(query['status']) }
statuses.update(status)
except:
stauts = { int(deploy.machine_id): 'unknown' }
statuses.update(status)
pass
return render_template('admin/list_deployments.html', deployments=AllDeploymentsProtected, statuses=statuses)
return render_template('admin/list_deployments.html', deployments=AllDeploymentsProtected, status=statuses)
@admin.route("/listservices", methods=['GET'])
@fresh_login_required

View file

@ -92,8 +92,8 @@ def dashboard(user_pid):
if invcls.machine_id == unit_id:
inv_deployments.remove(invcls)
flash('Support is notified about {}.'.format(str(cuser.inv_deployments.filter_by(machine_id=unit_id).first().machine_alias)))
send_email(current_app.config['MAIL_USERNAME'], 'Cube {} is unreachable'.format(unit_id),
'vmanager/email/adm_unreachable', user=current_user, unit_id=unit_id, error=repr(e))
if not current_user.is_administrator():
send_email(current_app.config['MAIL_USERNAME'], '{} experienced an error'.format(cuser.email), 'vmanager/email/adm_unreachable', user=current_user, unit_id=unit_id, error=repr(e))
continue
return render_template('panel/dashboard.html', sys_regions=sys_regions, inv_deployments=inv_deployments, inv_services=inv_services, inv_domains=inv_domains, inv_addresses=inv_addresses, rrd=rrd, status=statuses, warnflag=warnflag, regions=regions)

View file

@ -44,7 +44,7 @@
{% endif %}
<td data-title="Server">{{ deploy.server.name }}</td>
<td data-title="VLAN">{% for vlan in deploy.inv_pubvlans %}{{ vlan.vlan_id }}{% endfor %}</td>
<td data-title="Alias"><a class="rrd" data-toggle="tooltip" title="Protected: {{ deploy.protected }} ID: {{ deploy.machine_id }}"><b>{% if status[deploy.machine_id] == 'unknown' %}<font color="red">{% else %}<font color="green">{% endif %}{{ deploy.machine_alias }}</font></b></a></td>
<td data-title="Alias"><a class="rrd" data-toggle="tooltip" title="Protected: {{ deploy.protected }} ID: {{ deploy.machine_id }}"><b>{% if status[deploy.machine_id] == 'UNREACHABLE' %}<font color="red">{% else %}<font color="green">{% endif %}{{ deploy.machine_alias }}</font></b></a></td>
<td data-title="CPU">{{ deploy.machine_cpu }}</td>
<td data-title="Memory">{{ deploy.machine_mem }} MB</td>
<td data-title="HDD">{{ deploy.machine_hdd }} GB</td>