Merge ~laney/software-properties:token-pass-empty-string-not-none into software-properties:ubuntu/master

Proposed by Iain Lane on 2019-05-24
Status: Merged
Approved by: Sebastien Bacher on 2019-05-24
Approved revision: 294fd5efa0d96aa8d2bec2264ad6c1eb16eb5307
Merge reported by: Sebastien Bacher
Merged at revision: 294fd5efa0d96aa8d2bec2264ad6c1eb16eb5307
Proposed branch: ~laney/software-properties:token-pass-empty-string-not-none
Merge into: software-properties:ubuntu/master
Diff against target: 16 lines (+2/-1)
1 file modified
softwareproperties/gtk/LivepatchPage.py (+2/-1)
Reviewer Review Type Date Requested Status
Sebastien Bacher 2019-05-24 Approve on 2019-05-24
Ubuntu Core Development Team 2019-05-24 Pending
Review via email: mp+367899@code.launchpad.net

Description of the change

livepatch: Always pass a string to SetLivePatchEnabled

In the error case where we fail to retrieve a token, we'll get None back
from GOA. The D-Bus interface expects a string, so pass it an empty
string to avoid tracebacks and correctly display an error to the user.

This was already done in one case, but the retry case wasn't handled in
this way.

LP: #1830348

To post a comment you must log in.
Iain Lane (laney) wrote :

to reproduce the original error, hack the source and set the 'token' parameter to the calls to SetLivePatchEnabled() to None.

If you start s-p-gtk from a terminal you'll see the same error output there.

Sebastien Bacher (seb128) wrote :

That makes sense, thx!

review: Approve
Sebastien Bacher (seb128) wrote :

Uploaded (unsure why launchpad didn't automark it as merged)

https://git.launchpad.net/software-properties/commit/?id=d7e1e7618

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/softwareproperties/gtk/LivepatchPage.py b/softwareproperties/gtk/LivepatchPage.py
2index bd6d081..fabe8f6 100644
3--- a/softwareproperties/gtk/LivepatchPage.py
4+++ b/softwareproperties/gtk/LivepatchPage.py
5@@ -400,9 +400,10 @@ class LivepatchPage(object):
6 else:
7 # The user tooggled on/off the switch while we were waiting
8 # livepatch to respond back.
9+ token = self._auth.token or ''
10 self._parent.backend.SetLivepatchEnabled(
11 self._parent.switch_livepatch.get_active(),
12- self._auth.token,
13+ token,
14 reply_handler=self._enabled_reply_handler,
15 error_handler=self._enabled_error_handler,
16 timeout=1200)

Subscribers

People subscribed via source and target branches