Merge lp:~azzar1/ubuntu-release-upgrader/fix-1799310 into lp:ubuntu-release-upgrader

Proposed by Andrea Azzarone
Status: Merged
Merged at revision: 3212
Proposed branch: lp:~azzar1/ubuntu-release-upgrader/fix-1799310
Merge into: lp:ubuntu-release-upgrader
Diff against target: 199 lines (+93/-1)
8 files modified
DistUpgrade/DistUpgradeController.py (+21/-0)
DistUpgrade/DistUpgradeView.py (+3/-0)
DistUpgrade/DistUpgradeViewGtk3.py (+24/-0)
DistUpgrade/DistUpgradeViewKDE.py (+20/-0)
DistUpgrade/DistUpgradeViewNonInteractive.py (+2/-0)
DistUpgrade/DistUpgradeViewText.py (+6/-1)
debian/changelog (+16/-0)
debian/control (+1/-0)
To merge this branch: bzr merge lp:~azzar1/ubuntu-release-upgrader/fix-1799310
Reviewer Review Type Date Requested Status
Sebastien Bacher Needs Information
Review via email: mp+361896@code.launchpad.net

Commit message

Ask for confirmation if Livepatch is turned on, and you are upgrading to a version where Livepatch is not available.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for your work, one question. The design image on https://wiki.ubuntu.com/ReleaseUpgrades has a settings button on the bottom left corner, is that omitted on purpose in the implementation? (if so maybe add a comment stating why?)

review: Needs Information
Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Thanks for your work, one question. The design image on
> https://wiki.ubuntu.com/ReleaseUpgrades has a settings button on the bottom
> left corner, is that omitted on purpose in the implementation? (if so maybe
> add a comment stating why?)

The main reasons are:
- atm there is no way to ask software-properties-gtk to open the livepatch tab. We can open tab by numbers and not by name. Considering that we're moving around tabs, using the number is not a good solution.
- I want to keep the diff as small as possible. In particualar I had to add a mechanism to show that button only under Gtk3. Considering the controller/view model of ubuntu-release-upgrader it's not naive as it seems.

Considering these mpt agreed to not show the button for the moment.

Revision history for this message
Sebastien Bacher (seb128) wrote :

(thanks for the reply, also I was just having a look but would prefer if someone from foundations could review/upload so don't bail out just because I commented ;-)

Revision history for this message
Brian Murray (brian-murray) wrote :

I'll test this out today.

Revision history for this message
Brian Murray (brian-murray) wrote :

It's not a blocker for me per se but I thought it worth mentioning that some things don't match what is in the design. The dialog does not morph and the "turn off" dialog does not have the title bar label indicated in the design. Let me know if you want to get this changed or not. If you don't I'll merge it and upload it to the devel release.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'DistUpgrade/DistUpgradeController.py'
--- DistUpgrade/DistUpgradeController.py 2018-12-11 00:28:15 +0000
+++ DistUpgrade/DistUpgradeController.py 2019-01-17 14:54:46 +0000
@@ -22,6 +22,7 @@
2222
23import apt23import apt
24import apt_pkg24import apt_pkg
25import distro_info
25import sys26import sys
26import os27import os
27import subprocess28import subprocess
@@ -1151,6 +1152,23 @@
1151 self.cache.required_download)1152 self.cache.required_download)
1152 return res1153 return res
11531154
1155 def _isLivepatchEnabled(self):
1156 return os.path.isfile('/var/snap/canonical-livepatch/common/machine-token')
1157
1158 def askLivepatch(self):
1159 di = distro_info.UbuntuDistroInfo()
1160
1161 if not self._isLivepatchEnabled() or di.is_lts(self.toDist):
1162 return True
1163
1164 version = next((r.version for r in di.get_all("object") if r.series == self.toDist), self.toDist)
1165
1166 res = self._view.askCancelContinueQuestion(None,
1167 _("Livepatch security updates are not available for Ubuntu %s. "
1168 "If you upgrade, Livepatch will turn off.") % version)
1169 return res
1170
1171
1154 def _disableAptCronJob(self):1172 def _disableAptCronJob(self):
1155 if os.path.exists("/etc/cron.daily/apt"):1173 if os.path.exists("/etc/cron.daily/apt"):
1156 #self._aptCronJobPerms = os.stat("/etc/cron.daily/apt")[ST_MODE]1174 #self._aptCronJobPerms = os.stat("/etc/cron.daily/apt")[ST_MODE]
@@ -1874,6 +1892,9 @@
1874 "autocreated")1892 "autocreated")
1875 self.abort()1893 self.abort()
18761894
1895 if not self.askLivepatch():
1896 self.abort()
1897
1877 # run a "apt-get update" now, its ok to ignore errors, 1898 # run a "apt-get update" now, its ok to ignore errors,
1878 # because 1899 # because
1879 # a) we disable any third party sources later1900 # a) we disable any third party sources later
18801901
=== modified file 'DistUpgrade/DistUpgradeView.py'
--- DistUpgrade/DistUpgradeView.py 2018-05-04 13:52:53 +0000
+++ DistUpgrade/DistUpgradeView.py 2019-01-17 14:54:46 +0000
@@ -417,6 +417,9 @@
417 def askYesNoQuestion(self, summary, msg, default='No'):417 def askYesNoQuestion(self, summary, msg, default='No'):
418 " ask a Yes/No question and return True on 'Yes' "418 " ask a Yes/No question and return True on 'Yes' "
419 pass419 pass
420 def askCancelContinueQuestion(self, summary, msg, default='Cancel'):
421 " ask a Cancel/Continue question and return True on 'Continue'"
422 pass
420 def confirmRestart(self):423 def confirmRestart(self):
421 " generic ask about the restart, can be overridden "424 " generic ask about the restart, can be overridden "
422 summary = _("Reboot required")425 summary = _("Reboot required")
423426
=== modified file 'DistUpgrade/DistUpgradeViewGtk3.py'
--- DistUpgrade/DistUpgradeViewGtk3.py 2018-08-01 22:04:28 +0000
+++ DistUpgrade/DistUpgradeViewGtk3.py 2019-01-17 14:54:46 +0000
@@ -756,6 +756,30 @@
756 return True756 return True
757 return False757 return False
758758
759 def askCancelContinueQuestion(self, summary, msg, default='Cancel'):
760 if summary:
761 msg = "<big><b>%s</b></big>\n\n%s" % (summary,msg)
762
763 dialog = Gtk.MessageDialog(parent=self.window_main,
764 flags=Gtk.DialogFlags.MODAL,
765 type=Gtk.MessageType.WARNING,
766 buttons=Gtk.ButtonsType.NONE)
767 dialog.set_title("")
768 dialog.set_markup(msg)
769 dialog.add_buttons(_('Cancel'), Gtk.ResponseType.CANCEL,
770 _('Continue'), Gtk.ResponseType.ACCEPT)
771
772 if default == 'Cancel':
773 dialog.set_default_response(Gtk.ResponseType.CANCEL)
774 else:
775 dialog.set_default_response(Gtk.ResponseType.ACCEPT)
776
777 res = dialog.run()
778 dialog.destroy()
779 if res == Gtk.ResponseType.ACCEPT:
780 return True
781 return False
782
759 def confirmRestart(self):783 def confirmRestart(self):
760 self.dialog_restart.set_transient_for(self.window_main)784 self.dialog_restart.set_transient_for(self.window_main)
761 self.dialog_restart.set_title("")785 self.dialog_restart.set_title("")
762786
=== modified file 'DistUpgrade/DistUpgradeViewKDE.py'
--- DistUpgrade/DistUpgradeViewKDE.py 2018-08-29 12:03:28 +0000
+++ DistUpgrade/DistUpgradeViewKDE.py 2019-01-17 14:54:46 +0000
@@ -929,6 +929,26 @@
929 return True929 return True
930 return False930 return False
931931
932 def askCancelContinueQuestion(self, summary, msg, default='Cancel'):
933 messageBox = QMessageBox(QMessageBox.Warning, summary, msg, QMessageBox.NoButton, self.window_main)
934 continueButton = messageBox.addButton(QMessageBox.Apply)
935 cancelButton = messageBox.addButton(QMessageBox.Cancel)
936 continueButton.setText(_("Continue"))
937
938 if default == 'Cancel':
939 messageBox.setDefaultButton(cancelButton)
940 else:
941 messageBox.setDefaultButton(continueButton)
942
943 if summary is None:
944 flags = messageBox.windowFlags()
945 messageBox.setWindowFlags(flags | Qt.FramelessWindowHint)
946
947 answer = messageBox.exec_()
948 if answer == QMessageBox.Apply:
949 return True
950 return False
951
932 def confirmRestart(self):952 def confirmRestart(self):
933 messageBox = QMessageBox(QMessageBox.Question, _("Restart required"), _("<b><big>Restart the system to complete the upgrade</big></b>"), QMessageBox.NoButton, self.window_main)953 messageBox = QMessageBox(QMessageBox.Question, _("Restart required"), _("<b><big>Restart the system to complete the upgrade</big></b>"), QMessageBox.NoButton, self.window_main)
934 yesButton = messageBox.addButton(QMessageBox.Yes)954 yesButton = messageBox.addButton(QMessageBox.Yes)
935955
=== modified file 'DistUpgrade/DistUpgradeViewNonInteractive.py'
--- DistUpgrade/DistUpgradeViewNonInteractive.py 2018-05-04 13:52:53 +0000
+++ DistUpgrade/DistUpgradeViewNonInteractive.py 2019-01-17 14:54:46 +0000
@@ -305,6 +305,8 @@
305 #if default.lower() == "no":305 #if default.lower() == "no":
306 # return False306 # return False
307 return True307 return True
308 def askCancelContinueQuestion(self, summary, msg, default='Cancel'):
309 return True
308 def confirmRestart(self):310 def confirmRestart(self):
309 " generic ask about the restart, can be overridden "311 " generic ask about the restart, can be overridden "
310 logging.debug("confirmRestart() called")312 logging.debug("confirmRestart() called")
311313
=== modified file 'DistUpgrade/DistUpgradeViewText.py'
--- DistUpgrade/DistUpgradeViewText.py 2018-05-04 13:52:53 +0000
+++ DistUpgrade/DistUpgradeViewText.py 2019-01-17 14:54:46 +0000
@@ -254,7 +254,8 @@
254254
255 def askYesNoQuestion(self, summary, msg, default='No'):255 def askYesNoQuestion(self, summary, msg, default='No'):
256 print()256 print()
257 print(twrap(summary))257 if summary:
258 print(twrap(summary))
258 print(twrap(msg))259 print(twrap(msg))
259 if default == 'No':260 if default == 'No':
260 print(_("Continue [yN] "), end="")261 print(_("Continue [yN] "), end="")
@@ -271,6 +272,10 @@
271 return False272 return False
272 return True273 return True
273274
275 def askCancelContinueQuestion(self, summary, msg, default='Cancel'):
276 return self.askYesNoQuestion(summary, msg,
277 default='No' if default == 'Cancel' else 'Yes')
278
274# FIXME: when we need this most the resolver is writing debug logs279# FIXME: when we need this most the resolver is writing debug logs
275# and we redirect stdout/stderr 280# and we redirect stdout/stderr
276# def processEvents(self):281# def processEvents(self):
277282
=== modified file 'debian/changelog'
--- debian/changelog 2018-12-21 18:21:10 +0000
+++ debian/changelog 2019-01-17 14:54:46 +0000
@@ -1,3 +1,19 @@
1ubuntu-release-upgrader (1:19.04.9) UNRELEASED; urgency=medium
2
3 * DistUpgrade/DistUpgradeView.py,
4 DistUpgrade/DistUpgradeViewGtk3.py,
5 DistUpgrade/DistUpgradeViewKDE.py,
6 DistUpgrade/DistUpgradeViewNonInteractive.py,
7 DistUpgrade/DistUpgradeViewText.py:
8 - add askCancelContinueQuestion for all the supported views.
9 * DistUpgrade/DistUpgradeController.py: Ask for confirmation if Livepatch
10 is turned on, and you are upgrading to a version where Livepatch is not
11 available. (LP: #1799310)
12 * debian/control: add an explicit python3-distro-info dependency to
13 python3-distupgrade as it is now required by DistUpgradeController.
14
15 -- Andrea Azzarone <andrea.azzarone@canonical.com> Thu, 17 Jan 2019 04:16:29 -0800
16
1ubuntu-release-upgrader (1:19.04.9) disco; urgency=medium17ubuntu-release-upgrader (1:19.04.9) disco; urgency=medium
218
3 * DistUpgrade/xorg_fix_proprietary.py: shebang needs to use python3 not19 * DistUpgrade/xorg_fix_proprietary.py: shebang needs to use python3 not
420
=== modified file 'debian/control'
--- debian/control 2018-11-28 18:02:37 +0000
+++ debian/control 2019-01-17 14:54:46 +0000
@@ -40,6 +40,7 @@
40 ${misc:Depends},40 ${misc:Depends},
41 python3-update-manager (>= 1:19.04.2~),41 python3-update-manager (>= 1:19.04.2~),
42 python3-apt (>= 0.8.5~),42 python3-apt (>= 0.8.5~),
43 python3-distro-info,
43 gpgv,44 gpgv,
44 lsb-release,45 lsb-release,
45 sensible-utils46 sensible-utils

Subscribers

People subscribed via source and target branches