Skip to content
Snippets Groups Projects
Verified Commit 66d85e24 authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

fix a bug in the can_reuse_machine.py script

parent 9c2b3a32
No related branches found
No related tags found
No related merge requests found
......@@ -13,14 +13,16 @@ import greenhost_cloud
HOSTNAME = sys.argv[1]
IP_ADDRESS = sys.argv[2]
MACHINES = greenhost_cloud.get_droplets_by_name("^{}$".format(HOSTNAME))
if MACHINES == []:
print("No machines found with hostname {}".format(HOSTNAME))
exit(1)
for machine in MACHINES:
print("Machine status is {}".format(machine['status']))
print("Comparing IP address {} with IP address {}".format(
machine['networks']['v4'][0]['ip_address'], IP_ADDRESS))
if machine['status'] != 'running' or \
machine['networks']['v4'][0]['ip_address'] != IP_ADDRESS:
if machine['status'] != 'running' and \
machine['networks']['v4'][0]['ip_address'] == IP_ADDRESS:
exit(0)
exit(1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment