Project

General

Profile

Bug #12185

Inconsistent Host Creation

Added by Riley Shott almost 4 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Reporting
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

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:

http://pastie.org/private/13dhogrtbzxfjn4hdf1omq

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:

https://github.com/theforeman/foreman/blob/c1755e070ee10ee026e0b3996378368369c4ca83/app/models/host/managed.rb#L489

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.

Setup:

Foreman 1.9.1
SmartProxy 1.9.1

foreman_hostnames.png View foreman_hostnames.png 39.4 KB Riley Shott, 10/15/2015 01:18 PM
Foreman hostnames

Related issues

Related to Chef - Bug #12848: Duplicates host in Foreman consoleClosed2015-12-16

Associated revisions

Revision 5ef1e692 (diff)
Added by Marek Hulán almost 4 years ago

Fixes #12185 - host created via reports has downcased name

Revision f6e84664 (diff)
Added by Marek Hulán almost 4 years ago

Fixes #12185 - host created via reports has downcased name

(cherry picked from commit 5ef1e692a49950f503c9a95b8b88b7e569d79be7)

History

#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.

#2 Updated by The Foreman Bot almost 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2836 added
  • Pull request deleted ()

#3 Updated by Marek Hulán almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#4 Updated by Dominic Cleal almost 4 years ago

  • Legacy Backlogs Release (now unused) set to 63

#5 Updated by Marek Hulán over 3 years ago

  • Related to Bug #12848: Duplicates host in Foreman console added

Also available in: Atom PDF