1. 12 Dec, 2018 1 commit
    • Zachary Kent's avatar
      (PDB-4177) Make terminus send iso8601 strings · 47945b56
      Zachary Kent authored
      Prior to this commit the terminus would send epoch seconds in the
      producer-timestamp query param when pdb expected iso8601 strings. This
      caused pdb's time parsing function to return nils silently and resulted
      in all cmdrefs having nil values for producer-ts.
      47945b56
  2. 13 Sep, 2018 1 commit
  3. 07 Sep, 2018 1 commit
    • Jarret Lavallee's avatar
      (PDB-4020) Return the last successful reponse with command_broadcast · dcef3fac
      Jarret Lavallee authored
      Prior to this commit, the http submission with command_broadcast enabled
      always returned the last response. As a result, a failure would be shown if
      the last connection produced a 503 response even though there was
      previously a successful PuppetDB response and the minimum successful
      responses have been met. This issue does not occur with responses that
      raised an exception. Since the puppet http_pool does not raise 503
      as an exception, this issue can be seen when the PuppetDB is in
      maintenance mode.
      
      This commit changes the behavior to send the last successful response
      when the minimum successful submissions have been met.
      dcef3fac
  4. 09 Mar, 2018 1 commit
  5. 07 Mar, 2018 1 commit
  6. 08 Jan, 2018 1 commit
  7. 25 Oct, 2017 1 commit
    • Thomas Hallgren's avatar
      (PDB-3734) Ensure that resource indirection uses existing resource type · 99ce4c48
      Thomas Hallgren authored
      Before this commit, the resource type would be passed to `Resource#new`
      in string form. This is problematic since it may result in the load of
      a Ruby resource type which then is in conflict with genereated Pcore
      resource type.
      
      This commit ensures that the indirection uses the same logic as Puppet
      when creating new resources.
      99ce4c48
  8. 20 Jul, 2017 2 commits
    • Josh Cooper's avatar
      (PDB-3620) Use string 'alias' as a key in the parameters hash · be634126
      Josh Cooper authored
      In Puppet 5, Catalog#to_data_hash will only emit data types that are
      safe for JSON, YAML, etc, and in particular will never emit Symbols.
      
      When synthesizing an edge from any resource to an aliased resource:
      
          require => Package['my_alias']
      
      puppetdb would fail to find the target resource in the catalog. And that
      was because it was looking for the `:alias` parameter in the catalog
      hash, which didn't exist.
      
      This commit updates the add_namevar_alias and map_aliases_to_titles to
      use the String form of 'alias'. It adds a unit test demonstrating the
      problem, and updates other tests that relied on the previous symbol
      behavior.
      
      Note the terminus behaves different if the resource specifying the
      `alias` metaparam has multiple namevars (eg Package) or not.
      be634126
    • Josh Cooper's avatar
      (PDB-3620) Cleanup test · 022354df
      Josh Cooper authored
      Cleanup the test so it's clearer what's being tested. Also use the
      public method to test the behavior rather than select private methods.
      022354df
  9. 09 Jun, 2017 1 commit
    • Adrien Thebo's avatar
      (SERVER-1823) Remove Http.multi_arity_get · 7d0ed1c8
      Adrien Thebo authored
      Per PE-18347 earlier versions of Puppet and Puppetserver had different
      HTTP clients whose arity of `#get` was not consistent.
      `Http.multi_arity_get` was introduced to resolve this issue of varying
      functionarities and would select the appropriate http client invocation
      based on the arity of the underlying method. In Puppetserver 5 the HTTP
      client implementation was changed to match that of Puppet rendering the
      `.multi_arity_get` method unneeded; this commit removes the use of that
      method in favor of directly calling `#get` on the http client instance.
      7d0ed1c8
  10. 06 Jun, 2017 2 commits
  11. 05 Jun, 2017 1 commit
    • Adrien Thebo's avatar
      (SERVER-1823) Remove certname from http client metrics · ba79455d
      Adrien Thebo authored
      When metrics gathering was added for PuppetDB commands, the certname
      associated with the command was included as part of the metrics path.
      This can cause a large number of individual metrics to be generated in
      large environments, which is undesirable for a few reasons. By itself
      the number of metrics can be unwieldy, and there's memory overhead for
      storing each of these metrics.
      
      This commit reduces the metric proliferation by dropping the certname
      from the metrics path when an HTTP request is made.
      ba79455d
  12. 30 May, 2017 1 commit
    • Russell Mull's avatar
      (maint) Workaround PUP-7605 · a79b4a79
      Russell Mull authored
      Puppet is stringifying all resource titles in catalog.to_data_hash now, but
      catalog.resource(type, title) can't accept string titles in all case. It special
      cases :main, so apply the inverse special case here.
      a79b4a79
  13. 25 May, 2017 1 commit
  14. 24 May, 2017 2 commits
    • Thomas Hallgren's avatar
      951574ae
    • Thomas Hallgren's avatar
      (PDB-3527) Use #to_a method, not #to_data_hash when converting TagSets · c6651fea
      Thomas Hallgren authored
      The `Puppet::Util::TagSet` class has a method named `#to_data_hash`. It
      returns an `Array` instead of a `Hash`. PuppetDB assumes that the hash
      returned from a call to `Puppet::Resource::Catalog#to_data_hash` contains
      tag sets and calls the `#to_data_hash` to convert them into an `Array`.
      This now breaks because the bug that caused the hash to contain tag sets
      was fixed in PUP-7381.
      
      This commit changes the call to `#to_data_hash` to instead be a call to
      `#to_a`. Both the `Puppet::Util::TagSet` and the `Array` class implements
      this method which means that PuppetDB will be capable of munging catalogs
      produced both before and after PUP-7381.
      c6651fea
  15. 19 May, 2017 1 commit
  16. 09 May, 2017 1 commit
    • Adrien Thebo's avatar
      (maint) Use a real scope object for terminus testing · 4013d322
      Adrien Thebo authored
      Changes coming in Puppet 5.0.0 change how Puppet::Parser::Resource
      instances set default values; in specific they do so upon object
      construction which requires a functioning(ish) scope object. The
      Puppetdb terminus specs were relying on the scope object being
      relatively simple and easily stubbed but this change in defaults makes
      it much harder to treat the scope object as an easily stubbed object.
      
      To simplify stubbing and potentially reduce future breakage this commit
      changes the scope stubbing to partially stub a full scope object instead
      of creating a pure stub object and adding methods as necessary. By using
      a full scope object we can let the internal APIs of Puppet handle
      implementation changes.
      4013d322
  17. 08 May, 2017 1 commit
    • Adrien Thebo's avatar
      (maint) Use a real scope object for terminus testing · 4b48743d
      Adrien Thebo authored
      Changes coming in Puppet 5.0.0 change how Puppet::Parser::Resource
      instances set default values; in specific they do so upon object
      construction which requires a functioning(ish) scope object. The
      Puppetdb terminus specs were relying on the scope object being
      relatively simple and easily stubbed but this change in defaults makes
      it much harder to treat the scope object as an easily stubbed object.
      
      To simplify stubbing and potentially reduce future breakage this commit
      changes the scope stubbing to partially stub a full scope object instead
      of creating a pure stub object and adding methods as necessary. By using
      a full scope object we can let the internal APIs of Puppet handle
      implementation changes.
      4b48743d
  18. 03 Apr, 2017 1 commit
    • Rob Browning's avatar
      (PDB-3322) Redact sensitive parameters in terminus · fdd4ceff
      Rob Browning authored
      A resource parameter marked Sensitive()
      
        notify {'hi':  message => Sensitive('there')}
      
      will show up in the terminus
      like this:
      
              input = {...
                       'environment'=>'production',
                       'resources'=>
                       [...
                        {'type'=>'Notify',
                         'title'=>'hi',
                         'tags'=>Puppet::Util::TagSet.new(['notify', 'hi', 'class']),
                         'file'=> 'site.pp',
                         'line'=>1,
                         'exported'=>false,
                         'parameters'=>{:message=>'there'},
                         'sensitive_parameters'=>[:message]}],
                       'edges'=>
                       [{'source'=>'Stage[main]', 'target'=>'Class[Settings]'},
                        {'source'=>'Stage[main]', 'target'=>'Class[main]'},
                        {'source'=>'Class[main]', 'target'=>'Notify[hi]'}],
                       'classes'=>['settings']}
      
      Remove any sensitive values from 'parameters', and remove
      'sensitive_parameters' before sending data to PuppetDB.
      
      Aside from the fact that we don't want senstitive parameters to be
      stored in (or even make it to) PuppetDB, the 'sensitive_parameters'
      element can cause command processing to fail, e.g. when an existing
      parameter becomes sensitive.  Add an integration test for that.
      fdd4ceff
  19. 29 Mar, 2017 1 commit
    • Wyatt Alt's avatar
      (maint) fix spec test failures against puppet master · f34fcdd7
      Wyatt Alt authored
      A recent patch to Puppet broke several of our spec tests. This corrects
      the ones that are due to a changed error message. There are some other
      failures that are due to what seems like a Puppet bug to me. I'll wait
      to get confirmation before changing those ones.
      f34fcdd7
  20. 21 Mar, 2017 1 commit
    • Russell Mull's avatar
      (PDB-3328) Munge package inventory facts in terminus · d254ea9b
      Russell Mull authored
      This adds terminus support for that package inventory feature. When the
      _puppet_inventory_1 fact is seen it is removed, reformatted to be in the tabular
      format expected by puppetdb, and placed in a top-level 'package_inventory' key
      in the facts command payload.
      d254ea9b
  21. 10 Mar, 2017 1 commit
  22. 03 Mar, 2017 1 commit
    • Ruth Linehan's avatar
      (PE-18347) Handle multiple arities for `get` in http client class · ad0905ab
      Ruth Linehan authored
      Prior to Puppet Server 5, Puppet Server's http client class had an
      implementation of `get` with an arity of 2 (where `path` and `headers` are the
      arguments). However, in Ruby Puppet and in Puppet Server 5, the http client
      class has an implementation of `get` with an arity of 3 (with arguments
      `path`, `headers`, and `options`).
      
      Since we do not know under which version of Puppet Server or the Ruby Puppet
      master this terminus code will be run under, this commit adds a
      `multi_arity_get` helper function that inspects the `http_instance` class to
      determine the arity of `get` before calling it with the appropriate arguments
      for its arity.
      ad0905ab
  23. 01 Mar, 2017 1 commit
    • Ruth Linehan's avatar
      (PE-18347) Add metric_id option to http requests in termini · a98f40a4
      Ruth Linehan authored
      Add the `metric_id` option to the http requests in the facts terminus,
      resource terminus, query function, and for command submission. These
      `metric_id`s will be used by the http client Puppet Server uses to create
      metrics in its registry, which can then be queried to determine how long
      requests Puppet Server makes to PuppetDB are taking.
      
      For each element in a `metric_id` array, a metric is created. So, a `metric_id`
      `[:foo :bar :baz]` will result in metrics `foo`, `foo.bar`, and `foo.bar.baz`.
      The elements in the array can be symbols or strings. For more information, see
      the [documentation on metrics in the clj-http-client
      library](https://github.com/puppetlabs/clj-http-client/blob/master/doc/metrics.md).
      
      For the facts `find` action, the `metric_id` is `[:puppetdb :facts :find
      <node-name>]`.
      
      For the facts `search` action, the `metric_id` is `[:puppetdb :facts
      :search]`. The query is not included as part of the `metric_id` because it
      would not create useful metrics to capture - each search query can be pretty
      much anything, and tracking a single search query over time probably won't be
      very useful.
      
      For the resource `search` action, the `metric_id` is `[:puppetdb :resource
      :search <resource type>]`.
      
      For the http call made by the puppetdb query function, the `metric_id` is
      `[:puppetdb :query]`. This metric-id does not include the actual query, since
      there are so many possible queries that tracking metrics on them does not seem
      particularly useful.
      
      For the http requests for submitting commands, `metric_id`s will be
      `[:puppetdb :command <command name> <certname>]`.
      a98f40a4
  24. 08 Feb, 2017 1 commit
    • Jeremy Barlow's avatar
      (PDB-2640) Add support for gzip-compressing commands via terminus · 33c63ffc
      Jeremy Barlow authored
      This commit adds support for gzip-compressing commands which the
      PuppetDB terminus sends out.  When stockpile persists the commands to
      disk, it stores the gzipped json bytes with a .json.gz file extension.
      Command payloads are decompressed and parsed from JSON when processed
      back out of the queue.
      
      The terminus does not gzip-compress the command content itself.
      Instead, to minimize memory usage somewhat and realize a bit better
      performance, it passes through its intent for the implementation
      upstream from the Puppet::Network::HttpPool.http_instance to perform
      the gzip compression.  Corresponding work in Puppet Server and its
      upstream clj-http-client library enables the payload to be compressed.
      33c63ffc
  25. 07 Feb, 2017 3 commits
  26. 25 Oct, 2016 1 commit
    • Wyatt Alt's avatar
      (PDB-3071) Log a warning if retired server/port config items are in use. · 9be9a8ac
      Wyatt Alt authored
      It's relatively common for users to miss the retirement of server/port
      when upgrading from versions of PDB that supported it. This has the
      effect of defaulting their server/port to puppetdb:8081, producing agent
      run failures that log a puppetdb hostname different from what they
      believe they've configured.
      
      This patch logs warnings when server and port are detected in the config
      file. I think it would be preferable to remove the defaulting behavior
      and throw an error when server_urls is not present, but I don't have a
      sense of whether anyone relies on the defaulting today.
      9be9a8ac
  27. 10 Oct, 2016 1 commit
    • Wyatt Alt's avatar
      (PDB-3071) Log a warning if retired server/port config items are in use. · c95db47b
      Wyatt Alt authored
      It's relatively common for users to miss the retirement of server/port
      when upgrading from versions of PDB that supported it. This has the
      effect of defaulting their server/port to puppetdb:8081, producing agent
      run failures that log a puppetdb hostname different from what they
      believe they've configured.
      
      This patch logs warnings when server and port are detected in the config
      file. I think it would be preferable to remove the defaulting behavior
      and throw an error when server_urls is not present, but I don't have a
      sense of whether anyone relies on the defaulting today.
      c95db47b
  28. 04 Oct, 2016 1 commit
  29. 03 Oct, 2016 1 commit
  30. 11 Aug, 2016 1 commit
  31. 10 Aug, 2016 1 commit
  32. 03 Aug, 2016 1 commit
  33. 07 Jul, 2016 1 commit
  34. 06 Jul, 2016 1 commit
  35. 23 Jun, 2016 1 commit