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

Merge branch 'master' into 166-make-rocketchat-test-deployment

parents 14947e9b 33f26cd0
No related branches found
No related tags found
1 merge request!166Resolve "Make rocketchat test deployment"
......@@ -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)
......@@ -10,6 +10,7 @@ then
# script exits with 0 (true) if the machine can be reused
if python3 $(dirname "$0")/can_reuse_machine.py $HOSTNAME $ip_address
then
echo "Will reuse machine with hostname '$HOSTNAME' and ip address '$ip_address'"
exit 0
fi
fi
......
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