Ultimately if we decide to go with #2 here's a patch that I think would limit both the time cost of a remote uRL query and the noisy logging:
--- /usr/lib/python3/dist-packages/softwareproperties/gtk/utils.py 2021-06-10 23:20:22.000000000 -0600 +++ /usr/lib/python3/dist-packages/softwareproperties/gtk/utils.py.new 2021-07-14 15:32:54.559693094 -0600 @@ -26,6 +26,7 @@ gi.require_version("Gtk", "3.0") from gi.repository import Gio, Gtk import json +import os import subprocess import logging @@ -76,23 +77,12 @@ def get_ua_status(): """Return a dict of all UA status information or empty dict on error.""" # status.json will exist on any attached system or any unattached system - # which has already run `ua status`. Calling ua status directly on - # network disconnected machines will raise a TimeoutException trying to - # access contracts.canonical.com/v1/resources. - try: - # Success writes UA_STATUS_JSON - result = subprocess.run(['ua', 'status', '--format=json'], stdout=subprocess.PIPE) - except Exception as e: - print("Failed to call ubuntu advantage client:\n%s" % e) + # which has already run `sudo ua status`. + if not os.path.exists(UA_STATUS_JSON): return {} - if result.returncode != 0: - print("Ubuntu advantage client returned code %d" % result.returncode) - return {} - try: status_file = open(UA_STATUS_JSON, "r") except Exception as e: - print("No ua status file written:\n%s" % e) return {} with status_file as stream: -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1920836 Title: Show Extended Security Maintenence status To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/1920836/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs