Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data format example or doc link? #4

Open
sodabrew opened this issue Aug 6, 2013 · 3 comments
Open

Data format example or doc link? #4

sodabrew opened this issue Aug 6, 2013 · 3 comments

Comments

@sodabrew
Copy link

sodabrew commented Aug 6, 2013

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? :)

@vanzhiganov
Copy link

Up

@crayfishx
Copy link
Owner

@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?

@vanzhiganov
Copy link

vanzhiganov commented Jan 18, 2017

@crayfishx very lucidly explained, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants