Inconsistent Host Creation
I've found that when my hostname contains capital letters (e.g. HOSTNAME.domain.local) that two hosts will get created in the Foreman. One that contains the report information (that's upper-case), the other contains the fact information (that's lower-case). The debug logs for POSTing to /api/host/facts with a host that contains capitals looks like below:
I've also attached a sanitized screenshot of what this looks like in the Foreman.
I see in the code that you're down casing hostnames for importing facts, but don't see the same action taken when a node is created from a report upload:
Would it be possible to standardize how hosts are created from an import of reports and facts? I'm not fully aware of what the ramifications of this would be, but is it possible to not modify the hostname at all (i.e. create a host with the same name that was passed to the API)? As an experiment, I tried commenting out line 489 in the code above to see if it would only create one host, and tie the facts to the host with the capital hostname. It succeeded in the latter, but not the former. That is, I still ended up with 2 hosts in the Foreman UI, but the capital hostname entry had the facts tied to it. However, it still didn't auto-generate the Properties table of the host view for that capital hostname entry (i.e. Domain, MAC, IP Address). That table was still only filled out for the lower case host.
#1 Updated by Marek Hulán almost 4 years ago
- Project changed from Smart Proxy to Foreman
- Category set to Reporting
- Status changed from New to Assigned
- Assignee changed from Riley Shott to Marek Hulán
Thanks for the report. I saw the PR you've opened against chef-handler-foreman. That would fix it only for chef plugin but the same should be applied for all cfgmgmt tools so I'll send another fix against Foreman core.