[Pulp-list] puppet_forge on Pulp 2.9.2 400 BAD REQUEST

Russell E. Glaue rglaue at cait.org
Tue Sep 27 21:28:14 UTC 2016


I don't know what is going on, but it worked when I used the --debug flag.
It happened like this:

linux$ puppet module upgrade org-some-module --environment production --module_repository http://.:puppet-org-modules@pulp.example.com/pulp_puppet/forge/repository/puppet-org-modules --verbose --ignore-dependencies
(error 400 bad request)

linux$ puppet module upgrade org-some-module --environment production --module_repository http://.:puppet-org-modules@pulp.example.com/pulp_puppet/forge/repository/puppet-org-modules --verbose --ignore-dependencies
(error 400 bad request)

linux$ puppet module upgrade org-some-module --environment production --module_repository http://.:puppet-org-modules@pulp.example.com/pulp_puppet/forge/repository/puppet-org-modules --verbose --ignore-dependencies
(error 400 bad request)

linux$ puppet module upgrade org-some-module --environment production --module_repository http://.:puppet-org-modules@pulp.example.com/pulp_puppet/forge/repository/puppet-org-modules --verbose --debug --ignore-dependencies
(success)


What's up with that?
I have to really believe it is an issue with puppet only.
I have changed nothing on the puppet server or pulp.

And I ran the command with the --debug flag before.
It must work because it is cold outside today or something - it is the only thing I can think of that changed.

-RG


----- Original Message -----
From: "Russell E. Glaue" <rglaue at cait.org>
To: "pulp-list" <pulp-list at redhat.com>
Sent: Tuesday, September 6, 2016 2:28:30 PM
Subject: Re: [Pulp-list] puppet_forge on Pulp 2.9.2 400 BAD REQUEST

I need some help.

I spoke too quickly... I tried with another module, and am getting the same "400 BAD REQUEST" error.
I still get success with the last puppet module.

But I have some bread crumbs bow.

Here is what I am seeing in Pulp.

With the (previous) successful puppet module update, I see the following in the Pulp-Apache access log:
-
10.11.12.13 - - [06/Sep/2016:14:10:59 -0500] "GET /v3/releases?module=org-centos_server_base_yum_repos HTTP/1.1" 200 3915 "-" "PMT/1.1.1 (v3; Net::HTTP) Puppet/3.8.7 Ruby/1.8.7-p374 (x86_64-linux)"
10.11.12.13 - - [06/Sep/2016:14:10:59 -0500] "GET /v3/releases?module=org-centos_server_base_yum_repos HTTP/1.1" 200 3915 "-" "PMT/1.1.1 (v3; Net::HTTP) Puppet/3.8.7 Ruby/1.8.7-p374 (x86_64-linux)"
-

With the new puppet module I am attempting to update, I see the following in the Pulp-Apache access log:
-
10.11.12.13 - - [06/Sep/2016:14:11:19 -0500] "GET /v3/releases?module=org-server_user_mgmt HTTP/1.1" 200 6470 "-" "PMT/1.1.1 (v3; Net::HTTP) Puppet/3.8.7 Ruby/1.8.7-p374 (x86_64-linux)"
10.11.12.13 - - [06/Sep/2016:14:11:19 -0500] "GET /v3/releases?limit=20&module=org%252Fserver_user_mgmt&offset=20 HTTP/1.1" 400 23 "-" "PMT/1.1.1 (v3; Net::HTTP) Puppet/3.8.7 Ruby/1.8.7-p374 (x86_64-linux)"
-

I don't know what is different between the two puppet modules that would cause puppet update to behave differently.
BUT, notice the URL in the "400" request, it has the URL encoded string "%252F"
The error message puppet module update is giving me has the same URL, except for the encoded string of "%2F"

%2F = /
%24 = %

The URL that puppet tells me failed is getting doubly-encoded.
The successful module does not use a '/', but a '-', so that is why it works without error.

I have combed through my puppet configuration looking for non-ascii characters (grep -P "[\x80-\xFF]") but all are ASCII.

1. Why is puppet using '-' for one module, and '/' for another?
2. When using '/', why is the URL doubly-encoded when the request is made to Pulp? I think I remember reading that Pulp encodes the URLs it receives... is this true, and be why I am having this issue?

The "name" Pulp has for both is the same: "org/module_name" <- uses a slash in the name for both Pulp hosted puppet modules.

Any leads to point me towards an answer?

-RG




----- Original Message -----
From: "Russell E. Glaue" <rglaue at cait.org>
To: "pulp-list" <pulp-list at redhat.com>
Sent: Thursday, September 1, 2016 2:14:14 PM
Subject: Re: [Pulp-list] puppet_forge on Pulp 2.9.2 400 BAD REQUEST

I have resolved my own issue.

I appears that the problem is with puppet, and not with pulp.

In my last upgrade, when puppet was also upgraded, my /etc/puppet/puppet.conf file had some configuration reverted to the old environment settings.
regarding the [production] and [development] sections, the one that causes the following warning message:
-
Warning: Sections other than main, master, agent, user are deprecated in puppet.conf. Please use the directory environments feature to specify environments. (See http://docs.puppetlabs.com/puppet/latest/reference/environments.html)
   (at /usr/lib/ruby/site_ruby/1.8/puppet/settings/config_file.rb:82:in `unique_sections_in')
-

I went back and fixed the configuration to support the newer expected configuration for environments, setting environmentpath and basemodulepath variables in [main], and now I am no longer getting 400 BAD REQUEST. The modules install successfully.

This is really odd though. It makes me think their is some underlying compatibility issue when either handling this case specifically, or when handling some kind of regression in the request.

-RG


----- Original Message -----
From: "Russell E. Glaue" <rglaue at cait.org>
To: "pulp-list" <pulp-list at redhat.com>
Sent: Friday, August 26, 2016 5:45:04 PM
Subject: [Pulp-list] puppet_forge on Pulp 2.9.2 400 BAD REQUEST

I upgraded pulp from 2.7 to 2.8 to 2.9.2, and now am getting an error when performing a "puppet module upgrade" on a puppet server that obtains the puppet module from a pulp_puppet repository.

I am using the new syntax, as documented in the source code (/usr/lib/python2.7/site-packages/pulp_puppet/forge/views/releases.py)
-
    def get(self, request, resource_type=None, resource=None):
        """
        Credentials here are not actually used for authorization, but instead
        are used to identify:

            consumer ID in the username field
            repository ID in the password field

        This is to work around the fact that the "puppet module install"
        command has hard-coded absolute paths, so we cannot put consumer or
        repository IDs in the URL's path.
        """
-


Previously with Pulp 2.7 puppet_forge, to upgrade a puppet module I would do this successfully.
-
puppet module upgrade org-server_user_mgmt --environment production --module_repository http://pulp.example.com/pulp_puppet/forge/repository/puppet-org-modules --verbose
-
However, in Pulp 2.9.2, I get a "401 UNAUTHORIZED"


So, hence I use the new syntax, as follows, but getting a 400 error:
-
puppet module upgrade org-server_user_mgmt --environment production --module_repository http://.:puppet-org-modules@pulp.example.com/pulp_puppet/forge/repository/puppet-org-modules --verbose
Notice: Preparing to upgrade 'org-server_user_mgmt' ...
Notice: Found 'org-server_user_mgmt' (v1.0.3) in /etc/puppet/environments/production/modules ...
Error: Request to Puppet Forge failed.
  The server being queried was http://.:puppet-org-modules@pulp.example.com/v3/releases?limit=20&module=org%2Fserver_user_mgmt&offset=20
  The HTTP response we received was '400 BAD REQUEST'
-

However, if I curl that URL, I get a 200 OK
-
curl -v 'http://.:puppet-org-modules@pulp.example.com/v3/releases?limit=20&module=org%2Fserver_user_mgmt&offset=20'
...
< HTTP/1.1 200 OK
...
{"pagination": {"total": 23, "next": null, "current": "/v3/releases?limit=20&module=org%2Fserver_user_mgmt&offset=20", "limit": 20, "offset": 20, "first": "/v3/releases?limit=20&module=org%2Fserver_user_mgmt&offset=0", "previous": "/v3/releases?limit=20&module=org%2Fserver_user_mgmt&offset=0"}, "results": [{"file_uri": "/pulp/puppet/puppet-org-modules/system/releases/c/org/org-server_user_mgmt-0.9.1.tar.gz", "file_md5": "dfae4f555897b6d267ea9bbe0730676a", "metadata": {"version": "0.9.1", "name": "org/server_user_mgmt", "dependencies": [{"name": "puppetlabs-stdlib", "version_requirement": ">= 0.0.0"}]}}, {"file_uri": "/pulp/puppet/puppet-org-modules/system/releases/c/org/org-server_user_mgmt-0.9.5.tar.gz", "file_md5": "64828c52d568f03f77f2a1de969debdb", "metadata": {"version": "0.9.5", "name": "org/server_user_mgmt", "dependencies": [{"name": "puppetlabs-stdlib", "version_requirement": ">= 0.0.0"}]}}, {"file_uri": "/pulp/puppet/puppet-org-modules/system/releases/c/org/org-ser!
 ver_user_mgmt-0.9.20.tar.gz", "file_md5": "8d5c2a3b0c7a79f6d9403bfc38d5765a", "metadata": {"version": "0.9.20", "name": "org/server_user_mgmt", "dependencies": [{"name": "puppetlabs-stdlib", "version_requirement": ">= 0.0.0"}]}}]}
-


What is more, this module (org-server_user_mgmt) is currently on version 1.0.4 (the 23rd version; first release is 0.9.1)


What should I do to make `puppet module upgrade` work, with Pulp 2.9.2 puppet_forge?

-RG








_______________________________________________
Pulp-list mailing list
Pulp-list at redhat.com
https://www.redhat.com/mailman/listinfo/pulp-list

_______________________________________________
Pulp-list mailing list
Pulp-list at redhat.com
https://www.redhat.com/mailman/listinfo/pulp-list

_______________________________________________
Pulp-list mailing list
Pulp-list at redhat.com
https://www.redhat.com/mailman/listinfo/pulp-list




More information about the Pulp-list mailing list