From 115259492699a101bc6f9497bb438194cbe4d042 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Fri, 16 Jul 2021 18:11:07 +0100 Subject: [PATCH 09/11] boom: remove BOOM_ENTRY_OPTIONS hack from BootEntry.__from_data() Commit 92c2bce3 moved logic for accounting for add/del opts from the BootParams.from_entry() method into BootEntry.__from_data(). Although this is the more correct location to make these changes the rewriting of the stored BOOM_ENTRY_OPTIONS value is actually redundant: the entire value will be cleared by the pop-if-set logic applied to all template-generated keys in the final stage of loading a BootEntry from an entry_data array. Additionally the logic conflicts with the handling of host profile options modifications causing entries with an attached HostProfile to unexpectedly change boot_id. Remove the special handling of BOOM_ENTRY_OPTIONS and simplify the BootEntry.__from_data() method. Signed-off-by: Bryn M. Reeves --- boom/bootloader.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/boom/bootloader.py b/boom/bootloader.py index 3802ca8..feb669a 100644 --- a/boom/bootloader.py +++ b/boom/bootloader.py @@ -1360,34 +1360,17 @@ class BootEntry(object): self.machine_id = self.machine_id or "" self.architecture = self.architecture or "" - boot_id = self.boot_id if boot_params: self.bp = boot_params # boot_params is always authoritative self._entry_data[BOOM_ENTRY_VERSION] = self.bp.version else: _log_debug_entry("Initialising BootParams() from " - "BootEntry(boot_id='%s')" % boot_id) + "BootEntry(boot_id='%s')" % self.boot_id) # Attempt to recover BootParams from entry data self._bp = BootParams.from_entry(self) self._bp_generation = self._bp.generation - if BOOM_ENTRY_OPTIONS in self._entry_data: - orig_options = self._entry_data[BOOM_ENTRY_OPTIONS] - option_words = self.options.split() - - # Remove add_opts options from BootEntry stored options - opts = [opt for opt in option_words if opt not in self.bp.add_opts] - self._entry_data[BOOM_ENTRY_OPTIONS] = " ".join(opts) - - # Test whether the re-generated options match the stored values. - if boot_id != self.__generate_boot_id(): - self._entry_data[BOOM_ENTRY_OPTIONS] = orig_options - self.read_only = True - _log_warn("Options for BootEntry(boot_id=%s) do not match " - "OsProfile: marking read-only" % - boot_id[:min_boot_id_width()]) - if self.machine_id: # Wrap OsProfile in HostProfile if available self.__match_host_profile() -- 2.45.2