Project

Profile

Help

Story #1536

closed

As a user I would like support for v3/files API so that r10k may work

Added by tarrantmarshall almost 9 years ago. Updated over 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
2.8.0
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

The r10k system for puppet relies on a lot more of the v3 forge API to download modules
Ultimately it needs a list of releases, dependencies and file URI's - utilising what Forge would call their search API. Knowing Search isn't supported yet in the pulp puppet plugin, we could do some partial support to get r10k over the line which is commonly used.

From my discovery so far a new files endpoint, and release needs an extension.

v3/files
v3/releases/<author>-<name>-<version>

r10k makes these requests

GET /v3/files/ceh-nagios-1.2.0.tar.gz
GET /v3/modules/ceh-nagios
GET /v3/releases/ceh-nagios-1.2.0  #Currently gives a 400 error as it expects ?module=. Th

/v3/releases/ceh-nagios-1.2.0 currently gives a 400 error, and the output is different to what /v3/releases?modulename=ceh-nagios would be as the former is for a specific version.

Requests are made by the PuppetForge.gem used by r10k

I have hacked together some of the v3/files API response already to gauge how much of a task this would be and so far r10k seems happy with the mocked/partial response.
https://github.com/tarrantmarshall/pulp_puppet/blob/master/pulp_puppet_plugins/pulp_puppet/forge/views/files.py

Actions #1

Updated by lastmikoi almost 9 years ago

I second this request as Librarian-puppet, which uses the /v3/modules API endpoint, is currently unable to use a pulp_puppet-powered forge.

This issue, combined with https://pulp.plan.io/issues/945 effectively makes it impossible to use pulp_puppet in a production environment where multiple module versions are to be used from a same repository.

Actions #2

Updated by etparton almost 9 years ago

I’ve been looking into this issue as well, and it turns out that the “/v3/files/whatever.tar.gz” endpoint isn’t a part of the forge api; it’s just the location that the official Puppetlabs puppet forge hosts their module archive files. The json response from the releases endpoint contains a “file_uri” property which the PuppetForge gem can use to download the file:

{
    "file_md5": "74b0f2e2282c35c02b91d40911b7835e",
    "file_uri": "/pulp/puppet/test/system/releases/c/camptocamp/camptocamp-postfix-1.2.14.tar.gz",
    "metadata": {
        "dependencies": [
            {
                "name": "puppetlabs/stdlib",
                "version_requirement": ">=3.2.0 <5.0.0"
            },
            {
                "name": "camptocamp/augeas",
                "version_requirement": ">=1.0.0 <2.0.0"
            }
        ],
        "name": "camptocamp/postfix",
        "version": "1.2.14"
    }
}

I submitted a pull request (https://github.com/puppetlabs/forge-ruby/pull/24) to have the PuppetForge gem use the file_uri property instead of the hardcoded “/v3/files/” uri and one of their developers just merged it and cut a new release which will be automatically included in the current version of r10k.

I've also submitted a pull request (https://github.com/pulp/pulp_puppet/pull/207) for an implementation of the "/v3/releases/user-module-version” endpoint to the pulp-puppet repo. I’ve been testing the latest version of r10k with my Pulp development server that has the code from the pull request installed and it all works together perfectly.

The only caveat is that r10k requires the module api to download modules whose versions have not been not specified at all (it defaults to the latest version in this case). And as lastmikoi said earlier, librarian-puppet requires the module api in order to download anything.

Added by Eric Parton almost 9 years ago

Revision ba207e5a | View on GitHub

Added support for the /releases/{user}-{module}-{version} endpoint of the Puppet Forge v3 API

https://pulp.plan.io/issues/1536 closes #1536

Actions #3

Updated by tarrantmarshall almost 9 years ago

etparton wrote:

I submitted a pull request (https://github.com/puppetlabs/forge-ruby/pull/24) to have the PuppetForge gem use the file_uri property instead of the hardcoded “/v3/files/” uri and one of their developers just merged it and cut a new release which will be automatically included in the current version of r10k.

Ah. I coded a work around on my branch to basically return a HTTP REDIRECT to the actual file. PuppetForge gem follows it correctly.

I've also submitted a pull request (https://github.com/pulp/pulp_puppet/pull/207) for an implementation of the "/v3/releases/user-module-version” endpoint to the pulp-puppet repo. I’ve been testing the latest version of r10k with my Pulp development server that has the code from the pull request installed and it all works together perfectly.

Awesome! I was yet to code this part.

The only caveat is that r10k requires the module api to download modules whose versions have not been not specified at all (it defaults to the latest version in this case). And as lastmikoi said earlier, librarian-puppet requires the module api in order to download anything.

I have, for the most part, done the /modules part of the API and started on some unit tests. I'm not sure i'll have time in the next 10 days to complete it though.

https://github.com/aeria/pulp_puppet/commit/b509c05b2cdca26ed91347116d9ca9f6637eed3a

Actions #4

Updated by Anonymous almost 9 years ago

  • Status changed from NEW to MODIFIED
  • % Done changed from 0 to 100
Actions #5

Updated by dkliban@redhat.com almost 9 years ago

  • Status changed from MODIFIED to 5
  • Platform Release set to 2.8.0
Actions #6

Updated by dkliban@redhat.com over 8 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE
Actions #7

Updated by lastmikoi over 8 years ago

I believe this issue should be re-opened, as https://github.com/pulp/pulp_puppet/pull/207 implemented the `/v3/releases/module-name` endpoint but both the `/v3/files` (apparently used by r10k) and `/v3/modules` (used in my setup of librarian-puppet) are still missing from the API.

I don't know if r10k is able to use pulp_puppet as of now, but my librarian-puppet setup is failing because of the missing `/v3/modules` endpoint.

Actions #8

Updated by etparton over 8 years ago

lastmikoi wrote:

I believe this issue should be re-opened, as https://github.com/pulp/pulp_puppet/pull/207 implemented the `/v3/releases/module-name` endpoint but both the `/v3/files` (apparently used by r10k) and `/v3/modules` (used in my setup of librarian-puppet) are still missing from the API.

I don't know if r10k is able to use pulp_puppet as of now, but my librarian-puppet setup is failing because of the missing `/v3/modules` endpoint.

Fortunately, r10k no longer requires the unofficial files api to download modules, so it is able to work with the version of pulp-puppet that includes the pull request that you mentioned. I totally agree that the modules api should be implemented, but it might make sense to open a new issue with a more relevant name.

Actions #9

Updated by lastmikoi over 8 years ago

etparton wrote:

Fortunately, r10k no longer requires the unofficial files api to download modules, so it is able to work with the version of pulp-puppet that includes the pull request that you mentioned. I totally agree that the modules api should be implemented, but it might make sense to open a new issue with a more relevant name.

Fair enough, I'll file a new feature request for the `/v3/modules` API endpoint then.

Thanks for the clarification over r10k.

Actions #10

Updated by lastmikoi over 8 years ago

lastmikoi wrote:

Fair enough, I'll file a new feature request for the `/v3/modules` API endpoint then.

I filed https://pulp.plan.io/issues/1848 accordingly.

Actions #11

Updated by bmbouter over 5 years ago

  • Tags Pulp 2 added

Also available in: Atom PDF