Open tuxmea opened 5 months ago
Just in case anyone can provide an answer quickly:
The inventory endpoint currently provides us with definitive environment
for every node. Turns out the nodes endpoint gives us three instead: catalog_environment
, facts_environment
and report_environment
. I wonder which one should we use?
I am pretty sure we can discard report_environment
, which is nil
in some examples I have seen. In the same examples catalog_environment
and facts_environment
are the same. I suspect this is often the case, but probably not always. I also suspect that when they differ we are looking at edge cases where sometimes one is better than the other for our purposes, but there are also cases where it is the other way around.
I am tending towards just using catalog_environment
as this should, as far as I understand it, reflect the environment that is currently applied to the node. If the actual environment changed on the node, no new catalog has been applied since then and I believe there is no guarantee that facts_environment
will include newer information (though it might :man_shrugging:).
At the moment we use
inventory
API endpoint.We need to query PuppetDB for three different data:
Environments API endpoint: https://www.puppet.com/docs/puppetdb/8/api/query/v4/environments Certname Endpoint: https://www.puppet.com/docs/puppetdb/8/api/query/v4/nodes Facts Endpoint: https://www.puppet.com/docs/puppetdb/8/api/query/v4/nodes#pdbqueryv4nodesnodefacts