Merge lp:~renanrodrigo/update-manager/jammy-ss into lp:~ubuntu-core-dev/update-manager/jammy

Proposed by Renan Rodrigo
Status: Merged
Merged at revision: 2948
Proposed branch: lp:~renanrodrigo/update-manager/jammy-ss
Merge into: lp:~ubuntu-core-dev/update-manager/jammy
Diff against target: 86 lines (+13/-36)
1 file modified
ubuntu-security-status (+13/-36)
To merge this branch: bzr merge lp:~renanrodrigo/update-manager/jammy-ss
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team Pending
Review via email: mp+430921@code.launchpad.net

Commit message

ubuntu-security-status: Don't show ESM Apps information when the service is disabled, and prefer 'pro security-status' when it is available.

Description of the change

Port to Jammy of the change which landed in Kinetic.

Due to changes in the Pro launch strategy, the tooling should not advertise ESM-Apps even when it goes out of beta. If ubuntu-advantage-tools has made 'pro' available to the system, delegate the 'ubuntu-security-status' call to 'pro security-status' to make sure it reflects the Pro Client output.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu-security-status'
2--- ubuntu-security-status 2022-01-18 16:17:47 +0000
3+++ ubuntu-security-status 2022-10-03 18:06:12 +0000
4@@ -7,13 +7,13 @@
5 import os
6 import sys
7 import gettext
8+import shutil
9 import subprocess
10
11 from UpdateManager.Core.utils import get_dist
12
13 from datetime import datetime
14 from textwrap import wrap
15-from uaclient.entitlements import ESMAppsEntitlement
16 from urllib.error import URLError, HTTPError
17 from urllib.request import urlopen
18
19@@ -197,6 +197,12 @@
20
21
22 if __name__ == "__main__":
23+ # Prefer redirecting to 'pro security-status' if it exists
24+ if shutil.which("/usr/bin/pro"):
25+ print("This command has been replaced with 'pro security-status'.")
26+ subprocess.run(["/usr/bin/pro", "security-status"])
27+ sys.exit(0)
28+
29 # gettext
30 APP = "update-manager"
31 DIR = "/usr/share/locale"
32@@ -508,15 +514,11 @@
33 ("{:>{width}}".format(len(pkgstats.pkgs_mr),
34 width=width),
35 receive_text, eol_esm.month, eol_esm.year))
36- if lts and pkgstats.pkgs_um and (
37- is_ua_service_enabled("esm-apps") or not ESMAppsEntitlement.is_beta
38- ):
39- receive_text = "could receive"
40- if esm_apps_enabled:
41- if len(pkgstats.pkgs_um) == 1:
42- receive_text = "is receiving"
43- else:
44- receive_text = "are receiving"
45+ if lts and pkgstats.pkgs_um and is_ua_service_enabled("esm-apps"):
46+ if len(pkgstats.pkgs_um) == 1:
47+ receive_text = "is receiving"
48+ else:
49+ receive_text = "are receiving"
50 print("%s %s security updates with ESM Apps "
51 "until %d/%d" %
52 ("{:>{width}}".format(len(pkgstats.pkgs_um),
53@@ -571,32 +573,7 @@
54 print_wrapped(msg)
55 if ua_attached:
56 print("\nEnable ESM Infra with: ua enable esm-infra")
57- if lts and pkgstats.pkgs_um:
58- if (
59- not esm_apps_enabled and
60- not ESMAppsEntitlement.is_beta
61- ):
62- pkgs_updated_in_esma = pkgstats.pkgs_updated_in_esma
63- print("")
64- msg = gettext.dngettext(
65- "update-manager",
66- "Enable Extended Security "
67- "Maintenance (ESM Apps) to "
68- "get %i security update (so far) ",
69- "Enable Extended Security "
70- "Maintenance (ESM Apps) to "
71- "get %i security updates (so far) ",
72- len(pkgs_updated_in_esma)) % len(pkgs_updated_in_esma)
73- msg += gettext.dngettext(
74- "update-manager",
75- "and enable coverage of %i "
76- "package.",
77- "and enable coverage of %i "
78- "packages.",
79- len(pkgstats.pkgs_um)) % len(pkgstats.pkgs_um)
80- print_wrapped(msg)
81- if ua_attached:
82- print("\nEnable ESM Apps with: ua enable esm-apps")
83+
84 if lts and not ua_attached:
85 print("\nThis machine is not attached to an Ubuntu Advantage "
86 "subscription.\nSee https://ubuntu.com/advantage")

Subscribers

People subscribed via source and target branches