Last active
July 1, 2016 12:24
-
-
Save antoviaque/cac3a5fc7593134b777a1126fa32c976 to your computer and use it in GitHub Desktop.
Terminate old VMs of an instance, keep the last one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def terminate_old_instance_vms(domain): | |
inst = OpenEdXInstance.objects.get(internal_lms_domain=domain) | |
for appserver in inst.appserver_set.all().order_by('-created')[1:]: | |
appserver.terminate_vm() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment