On 14/06/16 20:37, Chris Clonch wrote:
> Using Foreman 1.10.3. Basically, I'm trying to diff provisioning
> templates outside of Foreman using the API. My thought was to grab the
> latest version, then the previous revision and diff 'em. I'm
> successfully retrieving the latest version of the provision template but
> failing to get any previous revisions. The docs
> <https://theforeman.org/api/1.10/apidoc/v2/provisioning_templates/revision.html>
> make me believe it can be done but are a little terse in how to use the
> endpoint.
It's a bad API, as it requires an ID of an audit entry that changes the
template to retrieve the contents of the template. You would need to use
/api/v2/audits to find the IDs, I don't think any data is supplied under
the template about its version history or audit entries.
> $ curl -s -H "Accept:application/json"-k -u
> ${FOREMAN_USER}:${FOREMAN_PASS}https://foreman.domain.com/api/provisioning_templates/revision?version=1
Then use this request, /api/v2/provisioning_templates/revision?version=1
where 1 is the ID of the audit entry that changes the template. It will
return a raw template, not JSON.
> {
> "error":{
> "message":"undefined method `template' for
> #<Setting::Auth:0x0000000a29e9b0>"
> }
> }
This may happen when the audit number is incorrect and doesn't point to
a template change.
--
Dominic Cleal
[email protected]
--
You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.