puppetlabs / puppetlabs-node_manager

Create and manage PE node groups as resources.
Apache License 2.0
10 stars 21 forks source link

Module should provide a mechanism to use the GET endpoint for nodes #45

Closed mhjacks closed 5 years ago

mhjacks commented 5 years ago

The GET endpoint of nodes allows access to historical checkins if that functionality is enabled. The endpoint is documented at: https://puppet.com/docs/pe/2019.0/nodes_endpoint.html#nodes-endpoint

It could be as simple as adding the following code the the nc_https.rb file:

  def get_nodes(name)
    res = do_https("v1/nodes/#{name}", 'GET')
    if res.code.to_i != 200
      error_msg(res)
      fail('Unable to get node history')
    else
      JSON.parse(res.body)
    end
  end
mhjacks commented 5 years ago

Created PR #46