Feature #13260
openRFE : allowing hammer-cli to search/update sc-parameters
Description
Hi,
Would it be possible to add the following feature to hammer-cli ? (and also in foreman webui, as it's not possible right now) :
Let's assume that a bunch of hosts in Foreman are using the puppet class puppet::class and that class has some variables. One variable (from a puppet point of view) can be $puppet::class:var1 and comes with a default value of 'foo'). Some hosts are using different value for that sc-parameter (for example 'bar' , through overrides)
How would it be possible to search for hosts that have that specific $puppet::class:var1 = 'bar' through webui (and then through hammer-cli) ?
From a discussion on irc, I was told that it's currently not possible.
That would be for step1, as then how would one update those hosts with a different value (for example changing $puppet::class:var1 from 'bar' to 'other_value')
Actually there is a way to find a list of hosts using that specific puppet class with " hammer host list --search 'class=puppet::class' ", but that doesn't get me the list of the hosts having a particular value for sc.
Happy to give more details if required, and thanks a lot !
Updated by Ewoud Kohl van Wijngaarden almost 9 years ago
https://gist.github.com/ekohl/58d97e3c4d3f8394c0d1 is a python script that uses the API to achieve this. I've opened #13517 and #13519 to make it more efficient, but I think this does what you want.
Updated by Ewoud Kohl van Wijngaarden almost 9 years ago
- Related to Bug #13517: Searching for smart class parameter override values in the API results into a 404 added
Updated by Ewoud Kohl van Wijngaarden almost 9 years ago
- Related to Feature #13519: Inconsistent naming in search and output when searching on smart class parameters added