Recently, some of our hosts started to show up without their domain in the hosts list. On there nodes, I noticed, that the environment variable “fqdn” does not work on puppet runs anymore. I asked in the Puppet Support and modified our modules to use facts[fqdn] instead, which works.
With some other nodes, this seems to lead to the following error in Foreman, when trying to edit a hosts parameters or add classes:
**Oops, we're sorry but something went wrong** PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_lookup_values_on_lookup_key_id_and_match" DETAIL: Key (lookup_key_id, match)=(132, fqdn=ibs-12-au) already exists.
I expected to still get the FQDN on puppet runs and that I could edit my hosts without running into this error.
Foreman and Proxy versions:
Tested on 2.4 and 2.5
Distribution and version:
Foreman-Server: Ubuntu 18.04
Nodes: Ubuntu 20.04, Puppet Agent 6.22.1
Other relevant data:
[I|app|57b947e2] Backtrace for 'Rolling back due to exception during save' error (ActiveRecord::RecordNotUnique): PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_lookup_values_on_lookup_key_id_and_match" 57b947e2 | DETAIL: Key (lookup_key_id, match)=(132, fqdn=ibs-12-au) already exists.