Skip to content

Cannot work with HTTP code 307 (redirect) #31

@krulls

Description

@krulls

Use case

We are using the Hiera backend (version 1.4.0) to download YAML files for our Puppet deployment manifests.

Environment

Internally we are working with Maven (https://maven.apache.org/) and Nexus OSS (http://www.sonatype.org/nexus/go/) to develop our packages that shall be deployed by Puppet.

In Nexus, artifacts that are developed have a name suffix "-SNAPSHOT", Nexus itself uses a redirect to deliver the latest SNAPSHOT version. A URL to a SNAPSHOT artifact looks like this:
http://internal.nexus.host:8080/service/local/artifact/maven/redirect?r=snapshots&g=ecg&a=our.artifact&v=1.0.0-SNAPSHOT&e=yaml

We are running Puppet (Version 3.6.2 with Ruby 1.9) apply command with Hiera configuration file to read values from a YAML file from our Nexus. This is the command line (Windows / Batch File)

puppet apply --modulepath=\\host.intern\modules -l %LogDir%\puppetizer.log --hiera_config=yaml\our_hiera_config.yaml .\manifests\doit.pp

Our Hiera configuration file (yaml\our_hiera_config.yaml) has this configuration:

:http:
  :host: internal.nexus.host
  :port: 8080
  :output: yaml
  :failure: graceful
  :paths:
    - /service/local/artifact/maven/redirect?r=snapshots&g=ecg&a=our.artifact&v=1.0.0-SNAPSHOT&e=yaml

Error

We are getting the following log output from Puppet:

2015-07-14 13:25:12 +0200 Puppet (debug): hiera(): [hiera-http]: Lookup url_authentication from internal.nexus.host:8080/service/local/artifact/maven/redirect?r=snapshots&g=ecg&a=our.artifact&v=1.0.0-SNAPSHOT&e=yaml
2015-07-14 13:25:12 +0200 Puppet (debug): hiera(): [hiera-http]: bad http response from internal.nexus.host:8080/service/local/artifact/maven/redirect?r=snapshots&g=ecg&a=our.artifact&v=1.0.0-SNAPSHOT&e=yaml
2015-07-14 13:25:12 +0200 Puppet (debug): hiera(): HTTP response code was 307

I am able to reproduce that by running Hiera alone, command:

C:\work\hiera-3.0.1\bin>hiera some_variable --debug --config C:\users\krulls\test.yaml

setting
set RUBYLIB=C:\work\hiera-http-1.4.0\lib
to include the Hiera http backend, of course

and result:

DEBUG: 2015-07-15 13:49:17 +0200: [hiera-http]: Lookup maven_artifact_full_id_authentication from internal.nexus.host:8080/service/local/artifact/maven/redirect?r=snapshots&g=ecg&a=our.artifact&v=1.0.0-SNAPSHOT&e=yaml
DEBUG: 2015-07-15 13:49:17 +0200: [hiera-http]: bad http response from internal.nexus.host:8080/service/local/artifact/maven/redirect?r=snapshots&g=ecg&a=our.artifact&v=1.0.0-SNAPSHOT&e=yaml
DEBUG: 2015-07-15 13:49:17 +0200: HTTP response code was 307
nil

Guesses

Quoting the 'paths' entry

like

  :paths:
    - "/service/local/artifact/maven/redirect?r=snapshots&g=ecg&a=our.artifact&v=1.0.0-SNAPSHOT&e=yaml"

--> Did not succeed

Unhandled http response code

This could be a problem with the underlying handler for http request. Maybe it is not able to work correctly with the certain HTTP code 307, see :
Nexus REST redirect reference?
Issue on an ANT task
SO question regarding Nexus REST API and WGET

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions