1
0
mirror of https://github.com/jcwimer/openstack-exporter synced 2026-03-24 17:44:42 +00:00

Clean up all instances with that name

This commit is contained in:
2020-12-03 19:55:33 -05:00
parent 95e5fa87f7
commit fb04acd27d

View File

@@ -60,10 +60,10 @@ def get_network(connection, network):
return None return None
def cleanup(connection, instance_name): def cleanup(connection, instance_name):
print(f"Cleaning up {instance_name} instance.") print(f"Cleaning up all instances with the name {instance_name}.")
server = connection.compute.find_server(instance_name) servers = connection.compute.servers(all_projects=True,name=instance_name)
if server: for server in servers:
try: try:
connection.compute.delete_server(server.id) connection.compute.delete_server(server.id)
except: except: