← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-sshkeyset-new into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-sshkeyset-new into launchpad:master.

Commit message:
Fix SSH key type comparison in SSHKeySet.new for Python 3

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/396283
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-sshkeyset-new into launchpad:master.
diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
index ed09f67..eb532ba 100644
--- a/lib/lp/registry/model/person.py
+++ b/lib/lp/registry/model/person.py
@@ -4136,8 +4136,9 @@ class SSHKeySet:
                 key = Key.fromString(sshkey.encode("UTF-8"))
             except Exception as e:
                 raise SSHKeyAdditionError(key=sshkey, exception=e)
-            if kind != key.sshType():
-                raise SSHKeyAdditionError(type_mismatch=(kind, key.sshType()))
+            keydatatype = six.ensure_str(key.sshType())
+            if kind != keydatatype:
+                raise SSHKeyAdditionError(type_mismatch=(kind, keydatatype))
 
         if send_notification:
             person.security_field_changed(