Hi all, relative newbie to Foreman here, trying to pull some data from the
Foreman API for use in another application.
I'll walk you through my thinking, so if I've made any mistakes, perhaps
someone might point them out to me. I'm trying to pull out parameter data
for a class on a host, which is set at hostgroup level in this case (but
might not always be).
So in Puppet, a host (or group of hosts) can have a class applied to it. As
part of including that class on the host, parameters must be populated with
values. The class can have default values to be used, or they can be
For example, if you click parameters at
you'll see where values are passed for particular classes.
If the value has been set at the hostgroup level, there doesn't seem to be
a way to fetch it via the host. I tried these two calls:
http://foreman/api/hosts/<host-id> - shows the classes, but not parameters
http://foreman/api/hosts/<host-id>/smart_class_parameters - shows default
values for parameters, but not where they've been over-ridden by the group
I can't even get it from the hostgroup calls:
The only way I've found so far is to fetch the class object:
This shows each parameter with an ID, so we can get the parameter object
This contains the values set for overriding parameters based on rules like
It doesn't seem possible to be able to fetch which parameters have been set
for a host, without parsing the rules to see if they match the host.
Is my understanding above all correct? Is there a shortcut that I'm missing
to finding out what values a host is using for a class?