Fix package name fetch during start/delete

The apt-ostree command expect to receive only the name of the
package to install/delete from the package archive repository,
and due to [1] the packages are stored with name+version,
leading to apt-ostree failure.

This commit splits name from version from the package list so
that apt-ostree failures are fixed.

[1] https://review.opendev.org/c/starlingx/update/+/909046

Test Plan
PASS: install a patch release successfully
PASS: delete a patch release and verify the package is deleted
      from apt-ostree package repository successfully

Story: 2010676
Task: TBD

Change-Id: Id7f8b8379aa0e870f1fa136cb2e629f020dde7f3
Signed-off-by: Heitor Matsui <heitorvieira.matsui@windriver.com>
This commit is contained in:
Heitor Matsui 2024-02-16 09:21:09 -03:00
parent 5b37af0ef6
commit 1182e86c08
1 changed files with 3 additions and 3 deletions

View File

@ -1339,7 +1339,7 @@ class PatchController(PatchService):
raise OSTreeTarFail(msg)
package_repo_dir = "%s/rel-%s" % (constants.PACKAGE_FEED_DIR, release_sw_version)
packages = self.release_data.metadata[release_id].get("packages")
packages = [pkg.split("_")[0] for pkg in self.release_data.metadata[release_id].get("packages")]
if packages:
apt_utils.package_remove(package_repo_dir, packages)
@ -2111,9 +2111,9 @@ class PatchController(PatchService):
LOG.info(msg)
audit_log_info(msg)
packages = self.release_data.metadata[release].get("packages")
packages = [pkg.split("_")[0] for pkg in self.release_data.metadata[release].get("packages")]
if packages is None:
msg = "Unable to determine pckages to install"
msg = "Unable to determine packages to install"
LOG.error(msg)
raise MetadataFail(msg)