diff --git a/manifests/db_type.pp b/manifests/db_type.pp index 7c953b4..c0490d0 100644 --- a/manifests/db_type.pp +++ b/manifests/db_type.pp @@ -5,7 +5,6 @@ define sunetdrive::db_type( $location=undef, $override_config = undef, $override_compose = undef, - $replicate_rewrite_db = undef, ) { diff --git a/manifests/mariadb.pp b/manifests/mariadb.pp index 8725c8a..c6356d2 100644 --- a/manifests/mariadb.pp +++ b/manifests/mariadb.pp @@ -5,7 +5,6 @@ class sunetdrive::mariadb ( $tag_mariadb = undef, $override_config = undef, $override_compose = undef, - $replicate_rewrite_db = undef, ) { $quorum_id = $facts['networking']['fqdn'] @@ -14,7 +13,6 @@ class sunetdrive::mariadb ( bootstrap => $bootstrap, tag_mariadb => $tag_mariadb, location => $location, - replicate_rewrite_db => $replicate_rewrite_db, } file { '/etc/quorum.conf': ensure => file, diff --git a/templates/mariadb/my.cnf.erb b/templates/mariadb/my.cnf.erb index 2892c01..81892bb 100644 --- a/templates/mariadb/my.cnf.erb +++ b/templates/mariadb/my.cnf.erb @@ -19,10 +19,6 @@ gtid_strict_mode = ON log_bin = binlog log_slave_updates = ON server_id = <%= @server_id %> -<% if not @replicate_rewrite_db.nil? -%> -replicate-rewrite-db = "<%= @replicate_rewrite_db %>->nextcloud" -replicate-wild-do-table = <%= @replicate_rewrite_db %>.% -<% end -%> # Innodb innodb_autoinc_lock_mode = 2 diff --git a/templates/script/restart-db-cluster.erb b/templates/script/restart-db-cluster.erb index 61d2f2f..af552cc 100755 --- a/templates/script/restart-db-cluster.erb +++ b/templates/script/restart-db-cluster.erb @@ -51,7 +51,7 @@ def remove_downtime(fqdn: str, def main() -> int: - customer = "<%= @customer %>" + customers = ["<%= @customer %>"] environment = "<%= @environment %>" apikey_test = "<%= @apikey_test %>" apikey_prod = "<%= @apikey_prod %>" @@ -59,38 +59,41 @@ def main() -> int: reboot_command = ['sudo /usr/local/bin/safer_reboot'] - for number in reversed(range(1, 4)): - fqdn = build_fqdn(customer, environment, number) - ipv4, _ = get_ips_for_hostname(fqdn) - 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") + if customers[0] == "common": + customers = ["gss", "lookup", "multinode"] + for customer in customers: + for number in reversed(range(1, 4)): + fqdn = build_fqdn(customer, environment, number) + ipv4, _ = get_ips_for_hostname(fqdn) + 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) - success = False + run_remote_command(fqdn, reboot_command, user = user) + success = False - for testnumber in reversed(range(1, 32, 2)): - print("\tSleeping for {} seconds before smoketest on {}".format( - testnumber, fqdn)) - time.sleep(testnumber) + for testnumber in reversed(range(1, 32, 2)): + print("\tSleeping for {} seconds before smoketest on {}".format( + testnumber, fqdn)) + time.sleep(testnumber) - if smoketest_db_node(fqdn, user = user): - success = True + if smoketest_db_node(fqdn, user = user): + success = True - break + break - remove_downtime(fqdn, apikey_test) - remove_downtime(fqdn, apikey_prod, monitor_host="monitor.drive.sunet.se") - if success: - print("Upgrade cycle succeeded on {} ".format(fqdn)) - else: - print("Smoketest failed on {} after server reboot command".format( - fqdn)) + remove_downtime(fqdn, apikey_test) + remove_downtime(fqdn, apikey_prod, monitor_host="monitor.drive.sunet.se") + if success: + print("Upgrade cycle succeeded on {} ".format(fqdn)) + else: + print("Smoketest failed on {} after server reboot command".format( + fqdn)) - return 5 - print("All {}-servers successfully upgraded for {}".format( - environment, customer)) + return 5 + print("All {}-servers successfully upgraded for {}".format( + environment, customer)) return 0