Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-9109

File: source attribute broken for HTTP(s) URI's containing query parameters

    XMLWordPrintable

    Details

    • Template:
      PUP Bug Template
    • Team:
      Coremunity
    • Sprint:
      Platform Core KANBAN
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Puppet now preserves query parameters when retrieving file metadata and content for http/https file resources.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Puppet Version: 4.4.0 - 5.5.6
      Puppet Server Version: All
      OS Name/Version: All

      We want to use the `source` attribute of the file type to get host specific stuff from a web service. For this we're using the following code:

      file { '/etc/path/to/file':
        ensure => file,
        source => 'https://fancywebservice.example.org/get_host_specific_config.py?host=foobar'
      }

      The important part here is the `host=foobar` parameter. If it's not added, the web service will return a 404.

      Desired Behavior:
      The file type should be able to retrieve a file from a http(s) URL which contains query parameters

      Actual Behavior:

      Error: /Stage[main]/Main/File[/etc/path/to/file]: Could not evaluate: Could not retrieve information from environment production source(s) https://fancywebservice.example.org/get_host_specific_config.py?host=foobar

      This happens, because Puppet, for reason unknown to me, requests only the `path` element of the uri and skips on the query parameters:

      https://github.com/puppetlabs/puppet/blob/7ec328f0832492353cad5b2b3ae6e90449fa105f/lib/puppet/util/http_proxy.rb#L184

       

      I will submit a PR to fix this.

        Attachments

          Activity

            People

            Assignee:
            josh Josh Cooper
            Reporter:
            baurmatt Matthias Baur
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support