[Merge] ~lamoura/update-notifier:update-esm-handling into update-notifier:master
Chad Smith
chad.smith at canonical.com
Mon Apr 12 22:17:53 UTC 2021
I think we might need a couple of changes here. Thanks Lucas for putting this together.
Diff comments:
> diff --git a/data/apt_check.py b/data/apt_check.py
> index 2c18ef6..b1c22a9 100755
> --- a/data/apt_check.py
> +++ b/data/apt_check.py
> @@ -73,11 +83,83 @@ def write_package_names(outstream, cache, depcache):
> outstream.write("\n".join([p.name for p in pkgs]))
>
>
> +def is_esm_distro():
> + proc = subprocess.Popen(
> + ["ubuntu-distro-info", "--series", DISTRO, "-yeol"],
This logic will also return True for groovy (non-LTS/non-esm). You also have to rule out non-LTS distros, because here you are only checking for end of life for the distro. I think we might have either check that `ubuntu-distro-info --series xenial -yeol-esm` != "(unknown)" to confirm a release that also has an esm end of life associated with it (groovy doesn't for instance).
Or we could opt to just parse the file ourselves `/usr/share/distro-info/ubuntu.csv` for the line containing the current DISTRO and split(,) grabbing the right index for a distro which has a valid esm-eol and where the current date is > eol.
> + stdout=subprocess.PIPE, stderr=subprocess.PIPE
> + )
> + days_until_esm, _ = proc.communicate()
> +
> + return True if int(days_until_esm.strip()) <= 0 else False
> +
> +
> +def _output_esm_package_count(outstream, service_type, esm_pkg_count):
> + if esm_pkg_count > 0:
> + outstream.write("\n")
> + outstream.write(gettext.dngettext("update-notifier",
> + "%i of these updates is fixed "
> + "through UA %s: ESM.",
> + "%i of these updates are "
> + "fixed through UA "
> + "%s: ESM.",
> + esm_pkg_count) %
> + (esm_pkg_count, service_type))
> +
> +
> +def _output_esm_package_alert(
> + outstream, service_type, esm_distro, disabled_pkg_count
> +):
> + if esm_distro:
> + outstream.write("\n")
> + if disabled_pkg_count > 0:
> + outstream.write("\n")
> + outstream.write(gettext.dngettext("update-notifier",
> + "Enable UA %s: ESM "
> + "to receive %i additional "
> + "security update.",
> + "Enable UA %s: ESM "
> + "to receive %i additional "
> + "security updates.",
> + disabled_pkg_count) %
> + (service_type, disabled_pkg_count))
> + else:
> + outstream.write("\n")
> + outstream.write(gettext.dgettext("update-notifier",
> + "Enable UA %s: ESM to "
> + "receive additional future "
> + "security updates.") %
> + service_type)
> +
> + outstream.write("\n")
> + outstream.write(gettext.dgettext("update-notifier",
> + "See https://ubuntu.com/security/esm "
> + "or run: sudo ua status"))
> +
> +
> def write_human_readable_summary(outstream, upgrades, security_updates,
> - esm_updates, have_esm, disabled_esm_updates):
> + esm_infra_updates, esm_apps_updates,
> + have_esm_infra, have_esm_apps,
> + disabled_esm_infra_updates,
> + disabled_esm_apps_updates):
> +
> + esm_distro = is_esm_distro()
> " write out human summary summary to outstream "
> - if have_esm is not None:
> - if have_esm:
> + if have_esm_apps is not None:
> + if not have_esm_apps:
> + ua_url = "https://ubuntu.com/advantage"
> + outstream.write(gettext.dgettext("update-notifier",
> + " * Introducing Extended "
I think we can drop this text in favor of ua client injecting its own banner via /etc/update-motd.d/88-updates-available which will source /var/lib/ubuntu-advantage/messages/esm-announce when present
> + "Security Maintenance for "
> + "Applications.\n Receive "
> + "updates to over 30,000 "
> + "software packages with your "
> + "Ubuntu Advantage subscription.\n"
> + " Free for personal use.\n\n"
> + " %s") % ua_url)
> + outstream.write("\n\n")
> +
> + if have_esm_infra is not None and esm_distro:
> + if have_esm_infra:
> outstream.write(gettext.dgettext("update-notifier",
> "UA Infra: Extended "
> "Security Maintenance (ESM) is "
--
https://code.launchpad.net/~lamoura/update-notifier/+git/update-notifier/+merge/401002
Your team Ubuntu Core Development Team is subscribed to branch update-notifier:master.
More information about the Ubuntu-reviews
mailing list