From 0136ecee29593a74f4a0695b0e69c3e77ef57340 Mon Sep 17 00:00:00 2001 From: Dostoievski Batista Date: Mon, 5 Feb 2024 15:06:53 -0300 Subject: [PATCH] Fix "reboot_required" and "unremovable" values inside metadata This commits change metadata.py to correctly read the values set on recipe's fields "reboot_required" and "unremovable" when creating a patch. Test Plan: PASS: Generate patch with "reboot_required" and "unremovable" set as "N". PASS: Generate patch with "reboot_required" and "unremovable" set as "Y". Closes-bug: 2052458 Change-Id: I9ba5058b296a63d98685882cee66ef6aa21c4f02 Signed-off-by: Dostoievski Batista --- build-tools/stx/patch/metadata.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build-tools/stx/patch/metadata.py b/build-tools/stx/patch/metadata.py index 86b78fbe..082cd432 100644 --- a/build-tools/stx/patch/metadata.py +++ b/build-tools/stx/patch/metadata.py @@ -109,15 +109,15 @@ class PatchMetadata(object): self.__add_text_tag_to_xml(top_tag, WARNINGS, self.warnings) self.__add_text_tag_to_xml(top_tag, STATUS, self.status) - if self.unremovable: - self.__add_text_tag_to_xml(top_tag, UNREMOVABLE, 'Y') + if self.unremovable.upper() in ["Y","N"]: + self.__add_text_tag_to_xml(top_tag, UNREMOVABLE, self.unremovable.upper()) else: - self.__add_text_tag_to_xml(top_tag, UNREMOVABLE, 'N') + raise Exception('Supported values for "Unremovable" are Y or N, for "Yes" or "No" respectively') - if self.reboot_required: - self.__add_text_tag_to_xml(top_tag, REBOOT_REQUIRED, 'Y') + if self.reboot_required.upper() in ["Y","N"]: + self.__add_text_tag_to_xml(top_tag, REBOOT_REQUIRED, self.reboot_required.upper()) else: - self.__add_text_tag_to_xml(top_tag, REBOOT_REQUIRED, 'N') + raise Exception('Supported values for "Reboot Required" are Y or N, for "Yes" or "No" respectively') self.__add_text_tag_to_xml(top_tag, SEMANTICS, self.semantics)