Also send an email if manage_ssh_key does not complete in time
This commit is contained in:
parent
2ff7eaea65
commit
f56933021f
1 changed files with 16 additions and 6 deletions
|
@ -230,12 +230,22 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id):
|
||||||
)
|
)
|
||||||
sleep(5)
|
sleep(5)
|
||||||
if not did_manage_public_key:
|
if not did_manage_public_key:
|
||||||
logger.error(
|
emsg = ("Waited for over 75 seconds for {} to be "
|
||||||
"Waited for over 75 seconds for {} to be "
|
"pingable. But the VM was not reachable. "
|
||||||
"pingable. But the VM was not reachable. So,"
|
"So, gave up manage_public_key. Please do "
|
||||||
"gave up manage_public_key. Do this "
|
"this manually".format(vm_ipv6))
|
||||||
"manually".format(vm_ipv6)
|
logger.error(emsg)
|
||||||
)
|
email_data = {
|
||||||
|
'subject': '{} CELERY TASK INCOMPLETE: {} not '
|
||||||
|
'pingable for 75 seconds'.format(
|
||||||
|
settings.DCL_TEXT, vm_ipv6
|
||||||
|
),
|
||||||
|
'from_email': current_task.request.hostname,
|
||||||
|
'to': settings.DCL_ERROR_EMAILS_TO_LIST,
|
||||||
|
'body': emsg
|
||||||
|
}
|
||||||
|
email = EmailMessage(**email_data)
|
||||||
|
email.send()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(str(e))
|
logger.error(str(e))
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue