software-properties: fixed livepatch removal bug
This commit is contained in:
parent
3136a2c93b
commit
61503a5c94
2 changed files with 90 additions and 2 deletions
87
helpers/DATA/software-properties/disable-livepatch.patch
Normal file
87
helpers/DATA/software-properties/disable-livepatch.patch
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
--- 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 """
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#!/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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue