Merge lp:~didrocks/launchpad/expose-sshkeys-bug-357235 into lp:launchpad/db-devel
| Status: | Merged |
|---|---|
| Approved by: | Michael Hudson-Doyle on 2010-03-24 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | not available |
| Proposed branch: | lp:~didrocks/launchpad/expose-sshkeys-bug-357235 |
| Merge into: | lp:launchpad/db-devel |
| Diff against target: |
200 lines (+98/-9) 5 files modified
lib/lp/registry/browser/configure.zcml (+6/-0) lib/lp/registry/browser/tests/test_sshkey.py (+31/-0) lib/lp/registry/interfaces/person.py (+8/-3) lib/lp/registry/interfaces/ssh.py (+10/-5) lib/lp/registry/stories/webservice/xx-person.txt (+43/-1) |
| To merge this branch: | bzr merge lp:~didrocks/launchpad/expose-sshkeys-bug-357235 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Francis J. Lacoste (community) | 2010-03-24 | Approve on 2010-03-24 | |
| Graham Binns | code | 2010-03-24 | Pending |
|
Review via email:
|
|||
This proposal supersedes a proposal from 2010-03-09.
Commit Message
Expose ssh keys into launchpad API
| Didier Roche (didrocks) wrote : | # |
The branch has been made in a pair programming session with jml, that's why I didn't added any more detail about it.
You can see inspiration and pair session programming on jml's gpg branch: http://
The change is for exposing ssh key to the API needed for Quickly. We don't allow uploading or setting it directly yet (this will be an UDS discussion).
https:/
output of make lint, I added also the testsuite call too:
$ make lint
utilities/shhh.py PYTHONPATH= python2.5 bootstrap.py\
--download-
Enter passphrase for key '/home/
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
== Pyflakes notices ==
lib/lp/
19: 'export_
19: 'export_
19: 'operation_
19: 'collection_
19: 'operation_
== Pylint notices ==
lib/lp/
520: [C0301] Line too long (80/78)
53: [F0401] Unable to import 'lazr.enum' (No module named enum)
54: [F0401] Unable to import 'lazr.lifecycle
55: [F0401] Unable to import 'lazr.restful.
56: [F0401] Unable to import 'lazr.restful.
63: [F0401] Unable to import 'lazr.restful.
410: [E1002, PersonNameField
1404: [C0322, IPersonEditRest
status=
^
comment=
@export_
def addMember(person, reviewer, status=
comment=None, force_team_
may_
1445: [C0322, IPersonEditRest
comment=Text())
^
@export_
def acceptInvitatio
1457: [C0322, IPersonEditRest
comment=Text())
^
@export_
def declineInvitati
1755: [C0322, IPersonSet.newTeam] Operator not preceded by a space
defaultmemb
^
defaultrene
@operation_
subscriptio
title=
| Graham Binns (gmb) wrote : | # |
Hi Didier, thanks for adding the details.
== Pyflakes notices ==
> lib/lp/
> 19: 'export_
> 19: 'export_
> 19: 'operation_
> 19: 'collection_
> 19: 'operation_
>
> == Pylint notices ==
>
> lib/lp/
> 520: [C0301] Line too long (80/78)
You can fix these easily enough. You can pretty much ignore the rest;
Pylint produces a lot of noise and should be taken out and shot.
Other than that I'm happy with this branch. Let me know if you want me
to land it for you (I don't know whether it needs to be landed with
jml's work or not).
| Francis J. Lacoste (flacoste) wrote : | # |
On March 9, 2010, Didier Roche wrote:
> class ISSHKey(Interface):
> """SSH public key"""
> - id = Int(title=
> +
> + export_
> +
> + id = exported(
> readonly=True)) person = Int(title=
> readonly=True)
> personID = Int(title=_('Owner ID'), required=True, readonly=True)
> - keytype = Choice(title=_("Key type"), required=True,
> - vocabulary=
> - keytext = TextLine(
> - comment = TextLine(
> - required=True)
> + keytype = exported(
> + vocabulary=
> + keytext = exported(
> + comment = exported(
> + required=True))
These fields should all be exported as readonly=True.
--
Francis J. Lacoste
<email address hidden>
| Didier Roche (didrocks) wrote : | # |
ok, those are fixed now. (readonly, uneeded import and too long lines). testsuite is still ok and here is the new make lint output:
$ make lint
utilities/shhh.py PYTHONPATH= python2.5 bootstrap.py\
--download-
Enter passphrase for key '/home/
Enter passphrase for key '/home/
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
== Pylint notices ==
lib/lp/
53: [F0401] Unable to import 'lazr.enum' (No module named enum)
54: [F0401] Unable to import 'lazr.lifecycle
55: [F0401] Unable to import 'lazr.restful.
56: [F0401] Unable to import 'lazr.restful.
63: [F0401] Unable to import 'lazr.restful.
410: [E1002, PersonNameField
1404: [C0322, IPersonEditRest
status=
^
comment=
@export_
def addMember(person, reviewer, status=
comment=None, force_team_
may_
1445: [C0322, IPersonEditRest
comment=Text())
^
@export_
def acceptInvitatio
1457: [C0322, IPersonEditRest
comment=Text())
^
@export_
def declineInvitati
1755: [C0322, IPersonSet.newTeam] Operator not preceded by a space
defaultmemb
^
defaultrene
@operation_
subscriptio
title=
required=False, default=
@export_
ITeam, ['name', 'displayname', 'teamdescription',
'defaultmem
def newTeam(teamowner, name, displayname, teamdescription
subscriptio
defaultmemb
1824: [C0322, IPersonSet.
created_
^
title=
created_
title=
)
@operation_
@export_
def findPerson(text="", exclude_
must...
| Karl Fogel (kfogel) wrote : | # |
I'm not a reviewer, but this looks pretty easy to review (and at least on the surface the change seems correct to me). The formatting fix at @@ -519,8 +520,8 @@ is unrelated -- personally, I find those distracting in a branch containing functional changes, but YMMV.
| Francis J. Lacoste (flacoste) wrote : | # |
Your test is not working yet, but we are getting there!
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -2172,4 +2172,9 @@
> classes="
> PersonProductFa
> module=
> + <browser:url
> + for="lp.
> + path_expression
> + rootsite="api"
> + attribute_
> </configure>
We usually refrain from exposing DB id publically. In URLs, especially. We
have a couple of exception and since there is no alternative here, I think
it's fine.
> === modified file 'lib/lp/
> --- lib/lp/
>
> oauth_request_
>
> - sshkeys = Attribute(_('List of SSH keys'))
> + sshkeys = exported(
> + CollectionField(
> + title= _('List of SSH keys'),
> + readonly=False, required=False,
> + value_type=
Can we rename that to ssh_keys? Unfortunately, you can't use exported_as
because of bug 546324. I think there isn't that many call sites, but feel free
to push back if this is too daunting a task.
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -16,6 +16,7 @@
> from zope.schema import Choice, Int, TextLine
> from zope.interface import Interface
> from lazr.enum import DBEnumeratedType, DBItem
> +from lazr.restful.
>
> from canonical.launchpad import _
>
> @@ -42,14 +43,18 @@
>
> class ISSHKey(Interface):
> """SSH public key"""
> - id = Int(title=
> +
> + export_
> +
> + id = exported(
> person = Int(title=
We don't want to export the DB id. It's not useful at all. I know it's leaked
into the URL, but that's an artefact.
> personID = Int(title=_('Owner ID'), required=True, readonly=True)
> - keytype = Choice(title=_("Key type"), required=True,
> - vocabulary=
> - keytext = TextLine(
> - comment = TextLine(
> - required=True)
> + keytype = exported(
> + vocabulary=
> + keytext = exported(
> + readonly=True))
> + comment = exported(
> + required=True, readonly=True))
> === modified file 'lib/lp/
> +== SSH keys ===
> +
> +People have SSH keys which we can manipulate over the API.
> +
> +The sample person "name12" doesn't have any keys to begin with:
> +
> + ...
| Didier Roche (didrocks) wrote : | # |
Thanks for your review!
Sorry for the test errors. Let's blame being tired about creating a GPG key and listing the existing ssh one :)
That's fixed in creating a new user, as "no-priv" had also an ssh key :)
In fact, keytext and keycomment aren't random (there is just a number appended at the end of generic-stringX. I ellided the number and so, don't thing we need to add a specific comment in makeSSHKey
I removed as well the exposal of id in ssh.py.
"Can we rename that to ssh_keys? Unfortunately, you can't use exported_as
because of bug 546324. I think there isn't that many call sites, but feel free
to push back if this is too daunting a task."
I'm more concerned about this one to be out of my poor knowledge of launchpad. I knew exported_as but as it seems to be broken with CollectionField… To be honest I'm a little bit scared on breaking everything in renaming it as Launchpad is so big :)
Don't hesitate to report any further issue. Thanks again for reviewing this.

Hi Didier,
I'm not comfortable reviewing this branch. There's no description of the change in the merge proposal description and I don't know whether you've had a pre-implementation discussion about the branch.
You need to include the following items when you submit a Launchpad branch for review:
* A description of the change, including a brief list of changes by file
* The output of `make lint`, run in the root of your branch.
* Details of the person with whom you had a pre implementation discussion, including (if necessary) details of why you chose the solution you did.
I'm going to reject this branch; please resubmit it with the above items included. If you want to have a pre-implementation discussion this afternoon I'll be happy to make myself available.