From a4aa87bd5aba09f497328021edc2523dd80abc03 Mon Sep 17 00:00:00 2001 From: Erik Moeller Date: Thu, 20 Feb 2020 16:36:08 -0800 Subject: [PATCH] Write `sdw-last-updated` after upgrades in REBOOT_REQUIRED case The UpdateThread never newly discovers that a reboot is required, it only picks up a reboot requirement from prior runs. Even if we added logic to discover the reboot requirement earlier, we won't know for sure whether updates have been successfully applied until the UpgradeThreads have completed. --- launcher/sdw_updater_gui/UpdaterApp.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/launcher/sdw_updater_gui/UpdaterApp.py b/launcher/sdw_updater_gui/UpdaterApp.py index 42080062..88cabbc0 100644 --- a/launcher/sdw_updater_gui/UpdaterApp.py +++ b/launcher/sdw_updater_gui/UpdaterApp.py @@ -246,11 +246,13 @@ def run(self): results[vm] = result self.progress_signal.emit(progress) - # write the flags to disk after successful updates, including updates - # that require a reboot. run_results = Updater.overall_update_status(results) Updater._write_updates_status_flag_to_disk(run_results) - if run_results in {UpdateStatus.UPDATES_OK, UpdateStatus.REBOOT_REQUIRED}: + # Write the "last updated" date to disk if the system is up-to-date. + # Even though no updates have been newly applied at this stage, for the + # purposes of security checks, all we need to know is that the system is + # up-to-date as of this run. + if run_results == UpdateStatus.UPDATES_OK: Updater._write_last_updated_flags_to_disk() # populate signal contents message = results # copy all the information from results @@ -290,7 +292,9 @@ def run(self): # write flags to disk run_results = Updater.overall_update_status(results) Updater._write_updates_status_flag_to_disk(run_results) - if run_results == UpdateStatus.UPDATES_OK: + # Write the "last updated" date to disk if the system is up-to-date + # after applying upgrades, regardless of whether a reboot is still pending. + if run_results in {UpdateStatus.UPDATES_OK, UpdateStatus.REBOOT_REQUIRED}: Updater._write_last_updated_flags_to_disk() # populate signal results message = results # copy all information from updater call