Merge ~lamoura/ubuntu/+source/ubuntu-advantage-tools:upload-27.13.1-lunar into ubuntu/+source/ubuntu-advantage-tools:ubuntu/devel

Proposed by Lucas Albuquerque Medeiros de Moura
Status: Merged
Merged at revision: 190cb95c878c080181b3fe07fff94605bfbaa008
Proposed branch: ~lamoura/ubuntu/+source/ubuntu-advantage-tools:upload-27.13.1-lunar
Merge into: ubuntu/+source/ubuntu-advantage-tools:ubuntu/devel
Diff against target: 71 lines (+21/-1)
4 files modified
debian/changelog (+7/-0)
uaclient/apt.py (+9/-0)
uaclient/tests/test_apt.py (+4/-0)
uaclient/version.py (+1/-1)
Reviewer Review Type Date Requested Status
Paride Legovini (community) Approve
Canonical Server Pending
Review via email: mp+436192@code.launchpad.net

Description of the change

Pro release for SRU:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/2003018

With a better isolated esm apt setup

To post a comment you must log in.
Revision history for this message
Paride Legovini (paride) wrote :

LGTM and should address the issue Andreas raised in his comment to the SRU bug.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index bf2df4b..519bdf0 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+ubuntu-advantage-tools (27.13.1~23.04.1) lunar; urgency=medium
7+
8+ * apt: better isolate apt esm cache by only fetching necessary
9+ configuration from the system apt
10+
11+ -- Lucas Moura <lucas.moura@canonical.com> Mon, 23 Jan 2023 11:54:06 -0300
12+
13 ubuntu-advantage-tools (27.13~23.04.1) lunar; urgency=medium
14
15 * d/bash-completion:
16diff --git a/uaclient/apt.py b/uaclient/apt.py
17index e98a637..15e9368 100644
18--- a/uaclient/apt.py
19+++ b/uaclient/apt.py
20@@ -603,6 +603,7 @@ def update_esm_caches(cfg) -> None:
21 return
22
23 import apt # type: ignore
24+ import apt_pkg # type: ignore
25
26 from uaclient.entitlements.entitlement_status import ApplicationStatus
27 from uaclient.entitlements.esm import (
28@@ -623,5 +624,13 @@ def update_esm_caches(cfg) -> None:
29 infra.setup_local_esm_repo()
30
31 # Read the cache and update it
32+ # Take care to initialize the cache with only the
33+ # Acquire configuration preserved
34+ for key in apt_pkg.config.keys():
35+ if "Acquire" not in key:
36+ apt_pkg.config.clear(key)
37+ apt_pkg.config.set("Dir", ESM_APT_ROOTDIR)
38+ apt_pkg.init_config()
39+
40 cache = apt.Cache(rootdir=ESM_APT_ROOTDIR)
41 cache.update()
42diff --git a/uaclient/tests/test_apt.py b/uaclient/tests/test_apt.py
43index 9dc3829..087a3cf 100644
44--- a/uaclient/tests/test_apt.py
45+++ b/uaclient/tests/test_apt.py
46@@ -1087,8 +1087,12 @@ class TestAptCacheTime:
47 @mock.patch("uaclient.apt.system.is_current_series_lts")
48 @mock.patch("uaclient.apt.system.is_current_series_active_esm")
49 @mock.patch("apt.Cache")
50+ @mock.patch("apt_pkg.config")
51+ @mock.patch("apt_pkg.init_config")
52 def test_update_esm_caches_based_on_lts(
53 self,
54+ _m_apt_pkg_init_config,
55+ _m_apt_pkg_config,
56 m_cache,
57 m_is_esm,
58 m_is_lts,
59diff --git a/uaclient/version.py b/uaclient/version.py
60index b87f757..6d14ab2 100644
61--- a/uaclient/version.py
62+++ b/uaclient/version.py
63@@ -15,7 +15,7 @@ from uaclient.defaults import CANDIDATE_CACHE_PATH, UAC_RUN_PATH
64 from uaclient.exceptions import ProcessExecutionError
65 from uaclient.system import subp
66
67-__VERSION__ = "27.13"
68+__VERSION__ = "27.13.1"
69 PACKAGED_VERSION = "@@PACKAGED_VERSION@@"
70
71 CANDIDATE_REGEX = r"Candidate: (?P<candidate>.*?)\n"

Subscribers

People subscribed via source and target branches

to status/vote changes: