Add full support for common infra
This commit is contained in:
parent
1cea9c9173
commit
598be8c2f1
1 changed files with 30 additions and 27 deletions
|
@ -51,7 +51,7 @@ def remove_downtime(fqdn: str,
|
||||||
|
|
||||||
|
|
||||||
def main() -> int:
|
def main() -> int:
|
||||||
customer = "<%= @customer %>"
|
customers = ["<%= @customer %>"]
|
||||||
environment = "<%= @environment %>"
|
environment = "<%= @environment %>"
|
||||||
apikey_test = "<%= @apikey_test %>"
|
apikey_test = "<%= @apikey_test %>"
|
||||||
apikey_prod = "<%= @apikey_prod %>"
|
apikey_prod = "<%= @apikey_prod %>"
|
||||||
|
@ -59,38 +59,41 @@ def main() -> int:
|
||||||
|
|
||||||
reboot_command = ['sudo /usr/local/bin/safer_reboot']
|
reboot_command = ['sudo /usr/local/bin/safer_reboot']
|
||||||
|
|
||||||
for number in reversed(range(1, 4)):
|
if customers[0] == "common":
|
||||||
fqdn = build_fqdn(customer, environment, number)
|
customers = ["gss", "lookup", "multinode"]
|
||||||
ipv4, _ = get_ips_for_hostname(fqdn)
|
for customer in customers:
|
||||||
ip = ipv4[0]
|
for number in reversed(range(1, 4)):
|
||||||
print("Upgrading: {} with ip: {}".format(fqdn, ip))
|
fqdn = build_fqdn(customer, environment, number)
|
||||||
add_downtime(fqdn, apikey_test)
|
ipv4, _ = get_ips_for_hostname(fqdn)
|
||||||
add_downtime(fqdn, apikey_prod, monitor_host="monitor.drive.sunet.se")
|
ip = ipv4[0]
|
||||||
|
print("Upgrading: {} with ip: {}".format(fqdn, ip))
|
||||||
|
add_downtime(fqdn, apikey_test)
|
||||||
|
add_downtime(fqdn, apikey_prod, monitor_host="monitor.drive.sunet.se")
|
||||||
|
|
||||||
run_remote_command(fqdn, reboot_command, user = user)
|
run_remote_command(fqdn, reboot_command, user = user)
|
||||||
success = False
|
success = False
|
||||||
|
|
||||||
for testnumber in reversed(range(1, 32, 2)):
|
for testnumber in reversed(range(1, 32, 2)):
|
||||||
print("\tSleeping for {} seconds before smoketest on {}".format(
|
print("\tSleeping for {} seconds before smoketest on {}".format(
|
||||||
testnumber, fqdn))
|
testnumber, fqdn))
|
||||||
time.sleep(testnumber)
|
time.sleep(testnumber)
|
||||||
|
|
||||||
if smoketest_db_node(fqdn, user = user):
|
if smoketest_db_node(fqdn, user = user):
|
||||||
success = True
|
success = True
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
remove_downtime(fqdn, apikey_test)
|
remove_downtime(fqdn, apikey_test)
|
||||||
remove_downtime(fqdn, apikey_prod, monitor_host="monitor.drive.sunet.se")
|
remove_downtime(fqdn, apikey_prod, monitor_host="monitor.drive.sunet.se")
|
||||||
if success:
|
if success:
|
||||||
print("Upgrade cycle succeeded on {} ".format(fqdn))
|
print("Upgrade cycle succeeded on {} ".format(fqdn))
|
||||||
else:
|
else:
|
||||||
print("Smoketest failed on {} after server reboot command".format(
|
print("Smoketest failed on {} after server reboot command".format(
|
||||||
fqdn))
|
fqdn))
|
||||||
|
|
||||||
return 5
|
return 5
|
||||||
print("All {}-servers successfully upgraded for {}".format(
|
print("All {}-servers successfully upgraded for {}".format(
|
||||||
environment, customer))
|
environment, customer))
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue