Clean requires field from metadata
When rehoming a subcloud to a new system controller, the system will
check the metadata to see which patches are in the requires field and
based on that it will try to find the ostree commits for those patches,
that won't work because the pre-patched iso only holds the latest commit
This change erases the values from the requires field when creating a
pre-patched iso.
Test plan:
PASS - Create pre-patched ISO with one patch
PASS - Create pre-patched ISO with two patches
Story: 2010676
Task: 51075
Change-Id: I31da4ae2947bedf9460bec41a9dfb81a40986245
Signed-off-by: Dostoievski Batista <dostoievski.albinobatista@windriver.com>
This commit is contained in:
@@ -227,15 +227,15 @@ def add_tag_xml(parent, name, text):
|
||||
tag.text = text
|
||||
|
||||
def update_metadata_info(metadata, iso_path):
|
||||
"""Adds ostree repository info to a metadata file
|
||||
"""Update iso's metadata files
|
||||
|
||||
This function get the ostree data from inside the iso and update
|
||||
metadata file with this information.
|
||||
This function updates the metadata files with information from
|
||||
the patches and the ostree repository.
|
||||
|
||||
:param metadata: Path to the metadata file
|
||||
:param iso_path: Path to the ISO
|
||||
"""
|
||||
logger.info("Adding ostree info to metadata...")
|
||||
logger.info("Updating metadata's info...")
|
||||
|
||||
# Load XML structure and create base
|
||||
tree = ET.parse(metadata)
|
||||
@@ -282,6 +282,11 @@ def update_metadata_info(metadata, iso_path):
|
||||
add_tag_xml(commit1_element, "commit", commit_value)
|
||||
add_tag_xml(commit1_element, "checksum", checksum_value)
|
||||
|
||||
# Remove requires field from metadata
|
||||
requires = root.find("requires")
|
||||
if requires is not None:
|
||||
requires.clear()
|
||||
|
||||
# Save metadata file changes
|
||||
tree.write(metadata)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user