diff --git a/slave_scripts/devstack-vm-reap.py b/slave_scripts/devstack-vm-reap.py index 70b53df7..7824e149 100755 --- a/slave_scripts/devstack-vm-reap.py +++ b/slave_scripts/devstack-vm-reap.py @@ -35,9 +35,15 @@ CLOUD_SERVERS_API_KEY = os.environ['CLOUD_SERVERS_API_KEY'] db = vmdatabase.VMDatabase() +if '--all' in sys.argv: + print "Reaping all known machines" + REAP_ALL = True +else: + REAP_ALL = False + print 'Known machines (start):' for machine in db.getMachines(): - print machine + print machine if CLOUD_SERVERS_DRIVER == 'rackspace': Driver = get_driver(Provider.RACKSPACE) @@ -55,11 +61,11 @@ def delete(machine): now = time.time() for machine in db.getMachines(): - if now-machine['created'] > 24*60*60: + if REAP_ALL or (now-machine['created'] > 24*60*60): print 'Deleting', machine['name'] delete(machine) print print 'Known machines (end):' for machine in db.getMachines(): - print machine + print machine