From 1b3234f49f784256e34bdbb3c4c03e6b97088544 Mon Sep 17 00:00:00 2001 From: deflax Date: Sat, 3 Feb 2018 20:40:03 +0200 Subject: [PATCH] show deploy name in flash exception message --- app/admin/routes.py | 2 +- app/panel/routes.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/admin/routes.py b/app/admin/routes.py index 2ddf4e7..f1d4b44 100644 --- a/app/admin/routes.py +++ b/app/admin/routes.py @@ -195,7 +195,7 @@ def dashboard(user_pid=0): 'type': 'kvm' } query = contact_proxmaster(data, 'vmrrd') if query['status'] == 'UNREACHABLE': - flash('Deploy #{} is unreachable. Support is notified.'.format(str(unit_id))) + flash('Deploy #{} is unreachable.'.format(str(unit_id))) send_email(current_app.config['MAIL_USERNAME'], 'Deploy {} is unreachable'.format(unit_id), 'vmanager/email/adm_unreachable', user=cuser, unit_id=unit_id ) else: diff --git a/app/panel/routes.py b/app/panel/routes.py index eb481ae..6d32964 100644 --- a/app/panel/routes.py +++ b/app/panel/routes.py @@ -40,7 +40,7 @@ def dashboard(): inv_deploycubeids = [] for invcls in inv_deployments: if invcls.user_id == cuser.pid: - inv_deploycubeids.extend([invcls.machine_id]) + inv_deploycubeids.extend([invcls.machine_id]) inv_services = cuser.inv_services.filter_by(deleted=False).order_by(Service.date_last_charge.asc()).all() inv_domains = cuser.inv_domains.filter_by(deleted=False).order_by(Domain.date_created.desc()).all() @@ -57,7 +57,7 @@ def dashboard(): query = contact_proxmaster(data, 'vmrrd') except Exception as e: current_app.logger.error(e) - flash('Support is notified.'.format(str(unit_id))) + 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=str(e)) #current_app.logger.info('debug query:') @@ -72,7 +72,8 @@ def dashboard(): statuses.update(status) except Exception as e: current_app.logger.error(e) - flash('Support is notified.'.format(str(unit_id))) + #flash('Support is notified.'.format(str(unit_id))) + 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=str(e))