Feature #3371
closedCustomize the data used to select the hostname for a discovered host
Description
From the mailinglist:
On 18 October 2013 16:49, <tomasz.nowaktn@gmail.com> wrote:
Hi,
Will it be possible to change hard-coded "macaddress_eth0" fact name that define default name of the discovered host to be custom name that is set in the Foreman settings?
It can be by default "macaddress_eth0", but I use discovery_init.sh script to setup some additional facts before they are imported into Foreman, and I want to use one of my facts to be a new default hostname as it allow me to easier identify discovered hosts.
Also some of my hosts do not have eth0 so hard-coded "macaddress_eth0" basically doesn't work very well with some machines.
At the moment hard-coded fact name is in the file app/models/host/discovered.rb.I experimented with using "macaddress" instead, but the TCL image creates a "dummy" interface that Facter seems to prefer over the real interface.
I think a good way forward is probably not to rely on a Fact at all, but to add an API parameter to Discovers#create, and > then discover the correct device in the bin/discover_host script. We could also add an optional kernel cmdline override as > well, for when the discovery image is somehow getting it wrong.