87 lines
3 KiB
Diff
87 lines
3 KiB
Diff
--- a/softwareproperties/LivepatchService.py 2020-01-06 15:10:21.950486591 -0500
|
|
+++ b/softwareproperties/LivepatchService.py 2020-01-06 15:07:49.294703393 -0500
|
|
@@ -29,8 +29,6 @@
|
|
import dateutil.parser
|
|
import requests_unixsocket
|
|
|
|
- gi.require_version('Snapd', '1')
|
|
- from gi.repository import Snapd
|
|
except(ImportError, ValueError):
|
|
pass
|
|
|
|
@@ -41,9 +39,6 @@
|
|
retry
|
|
)
|
|
|
|
-from softwareproperties.LivepatchSnap import LivepatchSnap
|
|
-
|
|
-
|
|
def datetime_parser(json_dict):
|
|
for (key, value) in json_dict.items():
|
|
try:
|
|
@@ -89,7 +84,6 @@
|
|
|
|
self._timeout_id = 0
|
|
|
|
- self._snap = LivepatchSnap()
|
|
self._session = requests_unixsocket.Session()
|
|
|
|
# Init Properties
|
|
@@ -129,8 +123,6 @@
|
|
# string rapresents the error message that needs to be shown if the
|
|
# callable returns false.
|
|
rules = [
|
|
- (lambda: self._snap.get_status() != Snapd.SnapStatus.UNKNOWN,
|
|
- _('Canonical Livepatch snap is not available.')),
|
|
(has_gnome_online_accounts,
|
|
_('Gnome Online Accounts is required to enable Livepatch.')),
|
|
(is_current_distro_lts,
|
|
@@ -177,16 +169,7 @@
|
|
Returns:
|
|
(False, '') if successful, (True, error_message) otherwise.
|
|
"""
|
|
- if self._enabled == enabled:
|
|
- return False, ''
|
|
-
|
|
- if not enabled:
|
|
- return self._disable_service()
|
|
- elif self._snap.get_status() == Snapd.SnapStatus.ACTIVE:
|
|
- return self._enable_service(token)
|
|
- else:
|
|
- success, msg = self._snap.enable_or_install()
|
|
- return self._enable_service(token) if success else (True, msg)
|
|
+ return self._disable_service()
|
|
|
|
def get_status(self):
|
|
"""Synchronously retrieve the status of Canonical Livepatch.
|
|
@@ -194,13 +177,7 @@
|
|
Returns:
|
|
str: The status. A valid string for success, None otherwise.
|
|
"""
|
|
- try:
|
|
- params = {'verbosity': 3, 'format': 'json'}
|
|
- r = self._session.get(self.STATUS_ENDPOINT, params=params)
|
|
- return r.json(object_hook=datetime_parser)
|
|
- except Exception as e:
|
|
- logging.debug('Failed to get Livepatch status: {}'.format(str(e)))
|
|
- return None
|
|
+ return None
|
|
|
|
# Private methods
|
|
def _enable_service(self, token):
|
|
--- a/softwareproperties/gtk/SoftwarePropertiesGtk.py 2020-01-06 15:10:21.970486562 -0500
|
|
+++ b/softwareproperties/gtk/SoftwarePropertiesGtk.py 2020-01-06 15:08:00.466687527 -0500
|
|
@@ -1038,12 +1037,7 @@
|
|
self.datadir)
|
|
d.run()
|
|
|
|
- self.quit_when_livepatch_responds = False
|
|
- if self.livepatch_page.waiting_livepatch_response:
|
|
- self.quit_when_livepatch_responds = True
|
|
- self.hide()
|
|
- else:
|
|
- self.quit()
|
|
+ self.quit()
|
|
|
|
def on_button_add_cdrom_clicked(self, widget):
|
|
""" when a cdrom is requested for adding """
|