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
=== modified file 'ubuntu-security-status'
--- ubuntu-security-status 2022-01-18 16:17:47 +0000
+++ ubuntu-security-status 2022-10-03 18:06:12 +0000
@@ -7,13 +7,13 @@
7import os7import os
8import sys8import sys
9import gettext9import gettext
10import shutil
10import subprocess11import subprocess
1112
12from UpdateManager.Core.utils import get_dist13from UpdateManager.Core.utils import get_dist
1314
14from datetime import datetime15from datetime import datetime
15from textwrap import wrap16from textwrap import wrap
16from uaclient.entitlements import ESMAppsEntitlement
17from urllib.error import URLError, HTTPError17from urllib.error import URLError, HTTPError
18from urllib.request import urlopen18from urllib.request import urlopen
1919
@@ -197,6 +197,12 @@
197197
198198
199if __name__ == "__main__":199if __name__ == "__main__":
200 # Prefer redirecting to 'pro security-status' if it exists
201 if shutil.which("/usr/bin/pro"):
202 print("This command has been replaced with 'pro security-status'.")
203 subprocess.run(["/usr/bin/pro", "security-status"])
204 sys.exit(0)
205
200 # gettext206 # gettext
201 APP = "update-manager"207 APP = "update-manager"
202 DIR = "/usr/share/locale"208 DIR = "/usr/share/locale"
@@ -508,15 +514,11 @@
508 ("{:>{width}}".format(len(pkgstats.pkgs_mr),514 ("{:>{width}}".format(len(pkgstats.pkgs_mr),
509 width=width),515 width=width),
510 receive_text, eol_esm.month, eol_esm.year))516 receive_text, eol_esm.month, eol_esm.year))
511 if lts and pkgstats.pkgs_um and (517 if lts and pkgstats.pkgs_um and is_ua_service_enabled("esm-apps"):
512 is_ua_service_enabled("esm-apps") or not ESMAppsEntitlement.is_beta518 if len(pkgstats.pkgs_um) == 1:
513 ):519 receive_text = "is receiving"
514 receive_text = "could receive"520 else:
515 if esm_apps_enabled:521 receive_text = "are receiving"
516 if len(pkgstats.pkgs_um) == 1:
517 receive_text = "is receiving"
518 else:
519 receive_text = "are receiving"
520 print("%s %s security updates with ESM Apps "522 print("%s %s security updates with ESM Apps "
521 "until %d/%d" %523 "until %d/%d" %
522 ("{:>{width}}".format(len(pkgstats.pkgs_um),524 ("{:>{width}}".format(len(pkgstats.pkgs_um),
@@ -571,32 +573,7 @@
571 print_wrapped(msg)573 print_wrapped(msg)
572 if ua_attached:574 if ua_attached:
573 print("\nEnable ESM Infra with: ua enable esm-infra")575 print("\nEnable ESM Infra with: ua enable esm-infra")
574 if lts and pkgstats.pkgs_um:576
575 if (
576 not esm_apps_enabled and
577 not ESMAppsEntitlement.is_beta
578 ):
579 pkgs_updated_in_esma = pkgstats.pkgs_updated_in_esma
580 print("")
581 msg = gettext.dngettext(
582 "update-manager",
583 "Enable Extended Security "
584 "Maintenance (ESM Apps) to "
585 "get %i security update (so far) ",
586 "Enable Extended Security "
587 "Maintenance (ESM Apps) to "
588 "get %i security updates (so far) ",
589 len(pkgs_updated_in_esma)) % len(pkgs_updated_in_esma)
590 msg += gettext.dngettext(
591 "update-manager",
592 "and enable coverage of %i "
593 "package.",
594 "and enable coverage of %i "
595 "packages.",
596 len(pkgstats.pkgs_um)) % len(pkgstats.pkgs_um)
597 print_wrapped(msg)
598 if ua_attached:
599 print("\nEnable ESM Apps with: ua enable esm-apps")
600 if lts and not ua_attached:577 if lts and not ua_attached:
601 print("\nThis machine is not attached to an Ubuntu Advantage "578 print("\nThis machine is not attached to an Ubuntu Advantage "
602 "subscription.\nSee https://ubuntu.com/advantage")579 "subscription.\nSee https://ubuntu.com/advantage")

Subscribers

People subscribed via source and target branches