Skip to content
Snippets Groups Projects
Commit 61503a5c authored by Ruben Rodriguez's avatar Ruben Rodriguez
Browse files

software-properties: fixed livepatch removal bug

parent 3136a2c9
No related branches found
No related tags found
No related merge requests found
--- 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 """
#!/bin/sh
#
# Copyright (C) 2011-2016 Rubén Rodríguez <ruben@trisquel.info>
# Copyright (C) 2011-2020 Ruben Rodriguez <ruben@trisquel.info>
# Copyright (C) 2011 Carlos Pais <freemind@lavabit.com>
# Copyright (C) 2019 Mason Hock <mason@masonhock.com>
#
......@@ -19,7 +19,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
VERSION=2
VERSION=3
. ./config
......@@ -69,6 +69,7 @@ rm -rf tests
sed '/gir1.2-snapd-1/d' -i debian/control
sed '/self.init_livepatch/d' -i softwareproperties/gtk/SoftwarePropertiesGtk.py
patch -p0 < $DATA/remove_livepatch_from_gtk_ui.patch
patch -p1 < $DATA/disable-livepatch.patch
sed 's/status = self.get_status()/status = Snapd.SnapStatus.UNKNOWN/' -i softwareproperties/LivepatchSnap.py
rm data/software-properties-drivers.desktop.in
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment