This message was deleted.
# puppet-enterprise
s
This message was deleted.
k
for context I'm doing this because we generate a splunk serverclass.conf using the list of nodes in each PE node group, and the existing implementation is buggy, so I'm just making it work correctly. there might be a better way to handle serverclass.conf though, which I'm going to look into after fixing the existing process.
b
o/
👋 1
nice, didnt know you deal with PE as well
I was hoping https://forge.puppet.com/modules/WhatsARanjit/node_manager/readme#node_groups also returns the matching nodes, but that doesnt seem to be the case :(
🤔 1
j
Yes, you need to get the translated rules from the group, and then make a query to PuppetDB for the results. That is what the console uses. https://www.puppet.com/docs/pe/2021.7/groups_endpoint.html#get-v1-groups-id-rules The “inventory” endpoint in puppetdb and coresponding format is likely going to be the most performant.
👍 1
thankyou 1
k
@jonathan.newman / @steveax I found that for node groups with no rules, i.e., <https://www.puppet.com/docs/pe/2021.7/groups_endpoint.html#get-v1-groups-id-rules%7CGET /v1/groups/<id>/rules> returns
null
in the
rule
key, the translated rules are returned as
[ "=", "node_state", "active" ]
, which matches all nodes, exactly the opposite of what is shown in the PE Console under "Matching nodes". Is this a bug in the API?
j
I could go either way about it being a bug. The behavior in the console is to indicate that no classification changes in that node group will be applied directly. Only children that have rules will apply classification.
k
ah I see what you mean. it was a surprise to me, but easy enough to deal with once I saw it.
j
It is confusing. We have considered forcing every level of the tree to have rules, which would avoid this confusion.