hiera-http icon indicating copy to clipboard operation
hiera-http copied to clipboard

Data format example or doc link?

Open sodabrew opened this issue 10 years ago • 3 comments

What should the data retrieved from the HTTP service look like?

If there's documentation on Puppet Labs' site that answers this, could you link to it? :)

sodabrew avatar Aug 06 '13 15:08 sodabrew

Up

vanzhiganov avatar Jan 16 '17 13:01 vanzhiganov

@vanzhiganov @sodabrew It largely depends on what kind of end point you are connecting to... The parameter :output is used to determine this...

If :output is set to json then hiera-http will treat the returned HTTP resonse body as a JSON document and search for the lookup key as a hash element, if that element exists then the value is returned. The same goes for setting :output to yaml. If :output is set to plain then it is assumed that whatever the endpoint returns requires no parsing and is sent back as the response "as-is".... A few examples, let's say you are looking up the key apache::port

Using json

http://my_cms/data/foo/bar returns:

{
  "apache::port": "80",
  "foo::bar": "tango"
}

Using the json setting for output the result 80 will be returned.

Using plain

http://my_cms/data/foo/bar returns:

80

The whole document, in this case, "80" will be returned.

Does this help explain your question?

crayfishx avatar Jan 16 '17 14:01 crayfishx

@crayfishx very lucidly explained, thank you

vanzhiganov avatar Jan 18 '17 10:01 vanzhiganov