From 3d11b057e6be9f65dc054ae0239c17ee5aa0240d Mon Sep 17 00:00:00 2001 From: Lindley Vieira Date: Tue, 19 Nov 2024 17:04:44 -0300 Subject: [PATCH] Fix the wrong apt-ostree package feed When installing the Debian packages, sometimes the package feed path was wrongly passed, using the default component "updates", instead of the release version. This commit fixes it by building and using the correct path for each patch. Test-plan: PASS: Deploy a patch in a SX system PASS: Deploy a patch in a DX system PASS: Deploy a patch in an upgraded SX system PASS: Deploy a patch in an upgraded DX system Story: 2010676 Task: 51379 Change-Id: I07aabdf49dae8474678a020917aaca5b57661c1d Signed-off-by: Lindley Vieira --- software/software/apt_utils.py | 8 +++++--- software/software/software_controller.py | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/software/software/apt_utils.py b/software/software/apt_utils.py index 5ae821d3..3457c6fb 100644 --- a/software/software/apt_utils.py +++ b/software/software/apt_utils.py @@ -8,7 +8,6 @@ import logging import subprocess from software import constants -import software.config as cfg from software.exceptions import APTOSTreeCommandFail LOG = logging.getLogger('main_logger') @@ -107,16 +106,19 @@ def component_remove(pkg_feed_dir, component): raise APTOSTreeCommandFail(msg) -def run_install(repo_dir, sw_release, packages): +def run_install(repo_dir, sw_version, sw_release, packages): """ Run Debian package upgrade. :param repo_dir: the path to the ostree repo + :param sw_version: System version (MM.mm) :param sw_release: Patch release version (MM.mm.pp) :param packages: List of Debian packages """ LOG.info("Running apt-ostree install") + package_feed = "http://controller:8080/updates/debian/rel-%s/ %s %s" \ + % (sw_version, constants.DEBIAN_RELEASE, sw_release) packages = " ".join(packages) try: @@ -124,7 +126,7 @@ def run_install(repo_dir, sw_release, packages): ["apt-ostree", "compose", "install", "--repo", repo_dir, "--branch", "starlingx", - "--feed", cfg.package_feed, + "--feed", package_feed, "--component", sw_release, packages], check=True, diff --git a/software/software/software_controller.py b/software/software/software_controller.py index 25d8cf30..22d2b671 100644 --- a/software/software/software_controller.py +++ b/software/software/software_controller.py @@ -2939,7 +2939,11 @@ class PatchController(PatchService): latest_commit = all_commits[0] # Install debian package through apt-ostree try: - apt_utils.run_install(feed_repo, deploy_release.sw_release, packages) + apt_utils.run_install( + feed_repo, + deploy_release.sw_version, + deploy_release.sw_release, + packages) except APTOSTreeCommandFail: msg = "Failed to install Debian packages." LOG.exception(msg)