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

Add a query string with environment when sending HTTP POST

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.0.0, PUP 4.1.0, PUP 4.2.0, PUP 4.2.1, PUP 4.2.2
    • Fix Version/s: PUP 4.4.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      Puppet 4.x agent

    • Template:
    • Story Points:
      1
    • Sprint:
      Client 2015-12-16
    • Release Notes:
      New Feature
    • Release Notes Summary:
      Hide
      POST messages in the Puppet v3 API will now include the environment as a query parameter, providing uniformity between GET and POST URLs. Puppet will use POST instead of GET for large requests, so this ensures load balancers can make decisions based on the environment.
      Show
      POST messages in the Puppet v3 API will now include the environment as a query parameter, providing uniformity between GET and POST URLs. Puppet will use POST instead of GET for large requests, so this ensures load balancers can make decisions based on the environment.

      Description

      Hello,

      When running a Puppet 4 run, every http call to PuppetServer includes a query string with the current "environment".

      GET /puppet/v3/node/test.dc01?environment=production
      GET /puppet/v3/file_metadata/modules/concat/concatfragments.rb?environment=production...
      PUT /puppet/v3/report/test.dc01?environment=production&
      .... 
      

      All except the POST to get the catalog

      POST /puppet/v3/catalog/test.dc01 HTTP/1.1
      

      It makes it hard to load-balance puppet load accross several puppetservers running differents environnments.

      Using Puppet3.x, the environment was in the uri, so it was easy to loadbalance :

        ProxyPassMatch ^/stable/ balancer://puppetserver timeout=600
        <Location ~ ^/stable/ >
         RequestHeader set X-Client-DN "CN=%{SSL_CLIENT_S_DN_CN}e"
         ProxyPassReverse balancer://puppetserver
        </Location>
      

      Using Puppet4, I am using ModRewrite :

        RewriteCond %{QUERY_STRING} ^(.*)environment=production(.*)$
        RewriteRule ^(.*) balancer://puppetserver$1 [P]
      

      It works well, except for the POST Catalog call.

      Is it possible to add also add a query string to this specific call ?

      Regards

      Olivier

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Olivier Hanesse Olivier Hanesse
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support