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:
@@ -60,10 +60,10 @@ def get_network(connection, network):
|
||||
return None
|
||||
|
||||
def cleanup(connection, instance_name):
|
||||
print(f"Cleaning up {instance_name} instance.")
|
||||
server = connection.compute.find_server(instance_name)
|
||||
print(f"Cleaning up all instances with the name {instance_name}.")
|
||||
servers = connection.compute.servers(all_projects=True,name=instance_name)
|
||||
|
||||
if server:
|
||||
for server in servers:
|
||||
try:
|
||||
connection.compute.delete_server(server.id)
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user