tear down SSH tunnel every time console button is clicked and on suspend, yapf a few things

This commit is contained in:
Jordan Rodgers 2018-04-26 02:59:09 -04:00
parent 9f7f5d27ca
commit dd876a8b2c
3 changed files with 19 additions and 28 deletions

View file

@ -24,16 +24,19 @@ def send_vm_expire_email(user, vms):
body = "The following VMs in Proxstar are expiring soon or have already expired:\n\n"
for vm in vms:
if vm[2] == -6:
body += " - {} ({}) has expired (VM has been stopped and will be deleted in 1 day)\n".format(vm[1], vm[0])
body += " - {} ({}) has expired (VM has been stopped and will be deleted in 1 day)\n".format(
vm[1], vm[0])
elif vm[2] < 0:
body += " - {} ({}) has expired (VM has been stopped and will be deleted in {} days)\n".format(
vm[1], vm[0], (7 + int(vm[2])))
elif vm[2] == 0:
body += " - {} ({}) expires today (VM has been stopped and will be deleted in 7 days)\n".format(vm[1], vm[0])
body += " - {} ({}) expires today (VM has been stopped and will be deleted in 7 days)\n".format(
vm[1], vm[0])
elif vm[2] == 1:
body += " - {} ({}) expires in 1 day\n".format(vm[1], vm[0])
else:
body += " - {} ({}) expires in {} days\n".format(vm[1], vm[0], vm[2])
body += " - {} ({}) expires in {} days\n".format(
vm[1], vm[0], vm[2])
body += "\nPlease login to Proxstar (https://proxstar.csh.rit.edu/) and renew any VMs you would like to keep."
send_email(toaddr, subject, body)
@ -44,8 +47,10 @@ def send_rtp_vm_delete_email(vms):
body = "The following VMs in Proxstar have expired and will be deleted soon:\n\n"
for vm in vms:
if vm[2] == -6:
body += " - {} ({}) will be deleted in 1 day\n".format(vm[1], vm[0])
body += " - {} ({}) will be deleted in 1 day\n".format(
vm[1], vm[0])
else:
body += " - {} ({}) will be deleted in {} days\n".format(vm[1], vm[0], (7 + int(vm[2])))
body += " - {} ({}) will be deleted in {} days\n".format(
vm[1], vm[0], (7 + int(vm[2])))
body += "\nPlease verify this list to ensure there aren't any pools included in Proxstar that shouldn't be."
send_email(toaddr, subject, body)