Merge ~nteodosio/software-properties:warning into software-properties:ubuntu/master

Proposed by Nathan Teodosio
Status: Work in progress
Proposed branch: ~nteodosio/software-properties:warning
Merge into: software-properties:ubuntu/master
Diff against target: 53 lines (+8/-2)
1 file modified
softwareproperties/gtk/UbuntuProPage.py (+8/-2)
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team Pending
Review via email: mp+438710@code.launchpad.net

Commit message

If present, display service warning.

To post a comment you must log in.

Unmerged commits

3401f58... by Nathan Teodosio

Retrieve and print warning if service has one.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/softwareproperties/gtk/UbuntuProPage.py b/softwareproperties/gtk/UbuntuProPage.py
2index 113fed0..02b5230 100644
3--- a/softwareproperties/gtk/UbuntuProPage.py
4+++ b/softwareproperties/gtk/UbuntuProPage.py
5@@ -29,11 +29,12 @@ from .DialogUaDetach import DialogUaDetach
6 from .DialogUaFipsEnable import DialogUaFipsEnable
7
8 class UaService:
9- def __init__(self, bus_object, name, entitled, status):
10+ def __init__(self, bus_object, name, entitled, status, warning):
11 self.bus_object = bus_object
12 self.name = name
13 self.entitled = entitled
14 self.status = status
15+ self.warning = warning
16 self.request_in_progress = False
17
18 class UbuntuProPage(object):
19@@ -131,7 +132,7 @@ class UbuntuProPage(object):
20 elif path.startswith('/com/canonical/UbuntuAdvantage/Services/'):
21 properties = interfaces_and_properties.get('com.canonical.UbuntuAdvantage.Service')
22 bus_object = bus.get_object('com.canonical.UbuntuAdvantage', path)
23- self.services[path] = UaService(bus_object, properties['Name'], properties['Entitled'], properties['Status'])
24+ self.services[path] = UaService(bus_object, properties['Name'], properties['Entitled'], properties['Status'], properties.get('Warning'))
25 self.update_status()
26 def on_interfaces_removed(path, interfaces):
27 if 'com.canonical.UbuntuAdvantage.Service' in interfaces:
28@@ -149,6 +150,7 @@ class UbuntuProPage(object):
29 service = self.services[path]
30 service.entitled = get_property(changed_properties, 'Entitled', service.entitled)
31 service.status = get_property(changed_properties, 'Status', service.status)
32+ service.warning = get_property(changed_properties, 'Warning', service.warning)
33 self.update_status()
34 object_manager_object = bus.get_object('com.canonical.UbuntuAdvantage', '/')
35 object_manager_object.connect_to_signal('InterfacesAdded', on_interfaces_added, dbus_interface='org.freedesktop.DBus.ObjectManager')
36@@ -176,6 +178,8 @@ class UbuntuProPage(object):
37 return service is not None and service.request_in_progress
38 def service_is_enabled(service):
39 return service is not None and service.status == 'enabled'
40+ def service_has_warning(service):
41+ return service is not None and service.warning is not None
42
43 def update_switch(switch, service, handler):
44 if service is not None and service.request_in_progress:
45@@ -199,6 +203,8 @@ class UbuntuProPage(object):
46 widget.set_sensitive(entitled_to_service(livepatch_service) and not service_request_in_progress(livepatch_service))
47 update_switch(self.switch_ua_livepatch, livepatch_service, self.on_ua_livepatch_changed_handler)
48 self.checkbutton_livepatch_topbar.set_sensitive(self.update_notifier_settings is not None and self.switch_ua_livepatch.get_active())
49+ if service_has_warning(livepatch_service):
50+ print(service.warning[Message])
51
52 fips_service = self.get_service('fips')
53 fips_updates_service = self.get_service('fips-updates')

Subscribers

People subscribed via source and target branches