Project

General

Profile

Actions

Bug #12185

closed

Inconsistent Host Creation

Added by Riley Shott over 8 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Reporting
Target version:
Difficulty:
Triaged:
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


Files

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

Related issues 1 (0 open1 closed)

Related to Chef - Bug #12848: Duplicates host in Foreman consoleClosedMarek Hulán12/16/2015Actions
Actions #1

Updated by Marek Hulán over 8 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.

Actions #2

Updated by The Foreman Bot over 8 years ago

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

Updated by Marek Hulán over 8 years ago

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

Updated by Dominic Cleal over 8 years ago

  • translation missing: en.field_release set to 63
Actions #5

Updated by Marek Hulán over 8 years ago

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

Also available in: Atom PDF