show deploy name in flash exception message

This commit is contained in:
deflax 2018-02-03 20:40:03 +02:00
parent 40c20abddc
commit 1b3234f49f
2 changed files with 5 additions and 4 deletions

View file

@ -195,7 +195,7 @@ def dashboard(user_pid=0):
'type': 'kvm' } 'type': 'kvm' }
query = contact_proxmaster(data, 'vmrrd') query = contact_proxmaster(data, 'vmrrd')
if query['status'] == 'UNREACHABLE': 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), send_email(current_app.config['MAIL_USERNAME'], 'Deploy {} is unreachable'.format(unit_id),
'vmanager/email/adm_unreachable', user=cuser, unit_id=unit_id ) 'vmanager/email/adm_unreachable', user=cuser, unit_id=unit_id )
else: else:

View file

@ -40,7 +40,7 @@ def dashboard():
inv_deploycubeids = [] inv_deploycubeids = []
for invcls in inv_deployments: for invcls in inv_deployments:
if invcls.user_id == cuser.pid: 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_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() 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') query = contact_proxmaster(data, 'vmrrd')
except Exception as e: except Exception as e:
current_app.logger.error(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), 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)) 'vmanager/email/adm_unreachable', user=current_user, unit_id=unit_id, error=str(e))
#current_app.logger.info('debug query:') #current_app.logger.info('debug query:')
@ -72,7 +72,8 @@ def dashboard():
statuses.update(status) statuses.update(status)
except Exception as e: except Exception as e:
current_app.logger.error(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), 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)) 'vmanager/email/adm_unreachable', user=current_user, unit_id=unit_id, error=str(e))