Already reported this as a bug, but since this may well be a misconception on my part (and because there was no response to the bug ), I’m asking here, too:
Problem:
We use Foreman (currently 3.11.2) with the “foreman_puppet” plugin (7.0.0). After the first regular puppet run on a newly provisioned bare metal host, the Foreman database contains a number of facts for the host that have the same name, but different name types (“DiscoveryFactName” and “PuppetFactName”) and, crucially, different values. When querying the Foreman API for hosts by fact values, Foreman seems to arbitrarily use either of the two values for the fact name, leading to inconsistent results.
I’m not sure what the error here is (maybe there is a mistake on our side).
- Should the facts from discovery be removed from the host at some point?
- Should the puppet facts replace discovery facts of the same name?
- Should there be a consistent precedence among the different fact types when querying?
Expected outcome: API queries consistently use recently collected fact values.
Foreman and Proxy versions: 3.11.2
Foreman and Proxy plugin versions:
foreman_discovery
: 24.0.1foreman_puppet
: 7.0.0puppetdb_foreman
: 6.0.2
Distribution and version: Debian 11.11 (Bullseye)
Other relevant data:
Example database contents:
# select fn.id as name_id, fn.name, fn.type, fv.id as value_id, fv.value, fv.updated_at from fact_values fv join hosts h on fv.host_id = h.id join fact_names fn on fv.fact_name_id = fn.id where h.name = hostname and fn.name = 'os::release::major';
name_id | name | type | value_id | value | updated_at
---------+--------------------+-------------------+----------+-------+----------------------------
5300939 | os::release::major | DiscoveryFactName | 32717847 | 8 | 2024-07-23 12:26:33.211309
3586 | os::release::major | PuppetFactName | 33177684 | 12 | 2024-09-17 11:11:56.556702
The PuppetFactName
value is the correct one in this case.