Add more repair commands and use tty for occ

This commit is contained in:
Micke Nordin 2023-04-26 09:26:46 +02:00
parent 7d10d168bd
commit 8ca66c10ad
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257

View file

@ -72,7 +72,10 @@ def main() -> int:
nc_upgrade_command = 'sudo /usr/local/bin/occ config:editable -on ' nc_upgrade_command = 'sudo /usr/local/bin/occ config:editable -on '
nc_upgrade_command += '&& sudo /usr/local/bin/occ upgrade ' nc_upgrade_command += '&& sudo /usr/local/bin/occ upgrade '
nc_upgrade_command += '&& sudo /usr/local/bin/occ config:editable --off' nc_upgrade_command += '&& sudo /usr/local/bin/occ config:editable --off'
repair_command = 'sudo /usr/local/bin/occ maintenance:repair' repair_command = 'sudo /usr/local/bin/occ maintenance:repair '
repair_command += '&& sudo /usr/local/bin/occ db:add-missing-indices '
repair_command += '&& sudo /usr/local/bin/occ db:add-missing-columns '
repair_command += '&& sudo /usr/local/bin/occ db:add-missing-primary-keys'
reboot_command = ['sudo /usr/local/bin/safer_reboot'] reboot_command = ['sudo /usr/local/bin/safer_reboot']
server_type = "node" server_type = "node"
if customer == "common": if customer == "common":
@ -116,9 +119,9 @@ def main() -> int:
return 6 return 6
fqdn = build_fqdn(customer, environment, 3, server_type) fqdn = build_fqdn(customer, environment, 3, server_type)
print("Running nextcloud upgrade command at {}".format(fqdn)) print("Running nextcloud upgrade command at {}".format(fqdn))
run_remote_command(fqdn, [nc_upgrade_command], user="script") run_remote_command(fqdn, [nc_upgrade_command], user="script", tty=True)
print("Running repair command on {}".format(fqdn)) print("Running repair command on {}".format(fqdn))
run_remote_command(fqdn, [repair_command], user="script") run_remote_command(fqdn, [repair_command], user="script", tty=True)
print("All {}-servers successfully upgraded for {}".format( print("All {}-servers successfully upgraded for {}".format(
environment, customer)) environment, customer))