GPG keys not exposed in API

Bug #389872 reported by Loïc Minier
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Low
Didier Roche-Tolomelli

Bug Description

Hi

I'd like to retrieve people's GPG keys from Launchpad as to generate a keyring from the ubuntu-dev / ubuntu-core-dev teams. I don't think this is currently exposed in API (apologies if it is, didn't find it on people's objects nor in the API ref).

Cheers,

----------------
what we need is:
- getting GPG keys available from Launchpad (and details info like emails)
- associate a new GPG key with a LP account
- get/sign the CoC

Related branches

affects: launchpadlib → launchpad-registry
tags: added: api
Curtis Hovey (sinzui)
Changed in launchpad-registry:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Jonathan Lange (jml) wrote :

This is a pretty straightforward bug to fix. There are two major components to it: setting up our GPG key objects to be exported via the API and then exporting the GPG key attributes that are on the Person object.

For the first one, you'll want to edit lp/registry/interfaces/gpg.py. In order to prepare the IGPGKey object for exporting, you'll need to tweak the interface a bit. I'd suggest looking at lp/registry/interfaces/sourcepackage.py for another example of this. The trick is to find the invocations of things that were imported from lazr.restful.

For the second one, look at lp/registry/interfaces/person.py. You'll see a bunch of attributes on the IPersonPublic interface that are wrapped in exported(). You'll want to do the same for gpgkeys, pendinggpgkeys and probably others.

You can run the tests for the Person webservice with the command './bin/test -1cvvt webservice/xx-person.txt'. You can find the tests in canonical/launchpad/pagetests/webservice/xx-person.txt. The tests really ought to live in lp/registry/stories/webservice/, but one thing at a time.

Running 'make build' and then 'make run' and browsing to https://launchpad.dev/+apidoc can be helpful for checking the API documentation, and for confirming that the attributes are, in fact, exposed.

Let me know if you have any questions.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Trying to work on it as it will be really useful for Quickly

Changed in launchpad-registry:
assignee: nobody → Didier Roche (didrocks)
status: Triaged → In Progress
Curtis Hovey (sinzui)
Changed in launchpad-registry:
milestone: none → 10.02
description: updated
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

for your information, I did a first try on lp:~didrocks/launchpad/devel. Unfortunately, I wasn't able to succeed from the documentation.

If someone can do that one, I can handle the other similar one on ssh key, which will avoid screenscrapping in Quickly (I need to get out 0.4 soon) and the same in other popular apps like Ground Control which seems to use that…

Revision history for this message
Curtis Hovey (sinzui) wrote :

Hi Didier.

Thanks for starting this. I think this is much more complicated that the initial statement of work. Many of the objects that contributors want to expose were never published in the Web UI; eg, GPGKeys do not have a URL. GPGKeys need to be published with a URL *before* they can be exposed to the restful API. This is also the reason why exporting the restful API is not trivial.

Launchpad uses the ZCML browser:url directive to define the URL for an object. I think we can the GPGKey to be subordinate to a person to create the Web url, something like this:

    <browser:url
        for="lp.registry.interfaces.gpgkey.IGPGKey"
        path_expression="string:+gpgkeyid/${keyid}"
        attribute_to_parent="owner"
        rootsite="api"/>

I expect your interfaces changes to work once the URL exists.

Curtis Hovey (sinzui)
Changed in launchpad-registry:
milestone: 10.02 → 10.03
Jonathan Lange (jml)
tags: added: quickly
Revision history for this message
Ursula Junque (ursinha) wrote : Bug fixed by a commit
Changed in launchpad-registry:
status: In Progress → Fix Committed
tags: added: qa-needstesting
Curtis Hovey (sinzui)
tags: added: qa-ok
removed: qa-needstesting
Revision history for this message
Curtis Hovey (sinzui) wrote : Bug 389872 Fix released

Fixed released in launchpad-project 10.03.

Changed in launchpad-registry:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.