From 97d96efd093e10476f69f7c33540ec37b3bbf829 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Thu, 29 Apr 2021 20:56:17 -0500 Subject: [PATCH] Attempt upgrade from UI 2x if it fails once - smooths over failures if upgrade script changes --- rootfs/standard/var/www/mynode/device_info.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rootfs/standard/var/www/mynode/device_info.py b/rootfs/standard/var/www/mynode/device_info.py index c8fd8a01..233d76de 100644 --- a/rootfs/standard/var/www/mynode/device_info.py +++ b/rootfs/standard/var/www/mynode/device_info.py @@ -165,7 +165,10 @@ def upgrade_device(): file1 = "/home/admin/upgrade_logs/upgrade_log_from_{}_upgrade.txt".format(get_current_version()) file2 = "/home/admin/upgrade_logs/upgrade_log_latest.txt" cmd = "/usr/bin/mynode_upgrade.sh 2>&1 | tee {} {}".format(file1, file2) - subprocess.call(cmd, shell=True) + ret = subprocess.call(cmd, shell=True) + if ret != 0: + # Try one more time.... + subprocess.call(cmd, shell=True) # Sync os.system("sync") @@ -183,7 +186,10 @@ def upgrade_device_beta(): file1 = "/home/admin/upgrade_logs/upgrade_log_from_{}_upgrade.txt".format(get_current_version()) file2 = "/home/admin/upgrade_logs/upgrade_log_latest.txt" cmd = "/usr/bin/mynode_upgrade.sh beta 2>&1 | tee {} {}".format(file1, file2) - subprocess.call(cmd, shell=True) + ret = subprocess.call(cmd, shell=True) + if ret != 0: + # Try one more time.... + subprocess.call(cmd, shell=True) # Sync os.system("sync")