Bug 1186537

Summary: [RFE] Settings -> Discovered provide setting to specify fact to use for hostname
Product: Red Hat Satellite Reporter: Paul Armstrong <parmstro>
Component: Discovery PluginAssignee: orabin
Status: CLOSED ERRATA QA Contact: Sachin Ghai <sghai>
Severity: medium Docs Contact:
Priority: unspecified    
Version: UnspecifiedCC: bbuckingham, bkearney, lzap, sghai, sthirugn
Target Milestone: UnspecifiedKeywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/9490
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 17:09:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
proposed patch - models/setting/discovered.rb
none
proposed patch - models/host/discovered.rb
none
discovery_hostname setting is missing in 6.2 beta snap6
none
defined hostname settings on UI
none
host discovered w/ hostname containing mac+uuid none

Description Paul Armstrong 2015-01-27 22:25:27 UTC
Description of problem:
RFE

Would like to be able to set the fact that is used for the hostname of the system. e.g. uuid, asset_tag, serialnumber, etc.. (or combination of tags.. nice to have.)

By default this is set in /opt/rh/../models/hosts/discovered.rb as:
fact_name = Setting[:discovery_fact] || 'macaddress'
hostname = facts[fact_name].try(:downcase).try(:gsub,/:/,'').try(:sub,/^/,'mac')

Issue is changing this fact changes the population of the macaddress on provisioning as well. Hostname setting should really be separate. 


Version-Release number of selected component (if applicable): 6.0.7


How reproducible: Always


Steps to Reproduce:
1. Set discovery_fact to serialnumber
2. Serialnumber gets substituted for macaddress when provisioning.
3.

Actual results:
as above

Expected results:
have separate setting that allows these two values to be independent of one another.

Additional info:

Comment 1 RHEL Program Management 2015-01-27 22:43:31 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 5 Paul Armstrong 2015-01-28 03:21:10 UTC
Created attachment 984962 [details]
proposed patch - models/setting/discovered.rb

Comment 6 Paul Armstrong 2015-01-28 03:22:01 UTC
Created attachment 984963 [details]
proposed patch - models/host/discovered.rb

Comment 8 Paul Armstrong 2015-01-28 04:15:02 UTC
Realm update may be a separate issue due to a bad keytab

Comment 9 Paul Armstrong 2015-01-28 04:34:08 UTC
bad owner/permissions on keytab 
fixed issue

Comment 11 Bryan Kearney 2015-02-20 18:19:48 UTC
Created redmine issue http://projects.theforeman.org/issues/9490 from this bug

Comment 13 Bryan Kearney 2015-02-26 13:04:41 UTC
Upstream bug assigned to orabin

Comment 14 Bryan Kearney 2015-02-26 13:04:43 UTC
Upstream bug assigned to orabin

Comment 15 Bryan Kearney 2015-08-25 18:33:11 UTC
Upstream bug component is Discovery Plugin

Comment 16 Bryan Kearney 2016-02-22 15:09:24 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/9490 has been closed
-------------
Imri Zvik
Applied in changeset commit:foreman_discovery|1f4e985b05d4af9d05e361a0fa9bdcbea3bc8efc.

Comment 18 Lukas Zapletal 2016-02-24 08:36:42 UTC
Yes, we are going to rebase Discovery to 5.0.3+ for 6.2. If we manage to merge this patch today hopefuly...

Comment 19 Lukas Zapletal 2016-02-24 08:37:52 UTC
Oh this one was already merged, we still have couple of upstream bugs I target for 5.0: https://github.com/theforeman/foreman_discovery/pulls

Comment 22 Sachin Ghai 2016-04-05 09:13:43 UTC
@Lzap, Hey, what is the name of new setting that can be used for hostname ?

I set 'discovery_fact' to use 'uniqeid' but then discovery failed with error:

Body: {"message":"ERF42-1746 [Foreman::Exception]: Unable to detect primary interface using MAC 'a8c01264' specified by discovery_fact 'uniqueid'"}


Also, I can see couple of new setting there:

- discovery_facts_hardware
- discovery_facts_highlights
- discovery_facts_ipmi
- discovery_facts_network
- discovery_facts_software
- discovery_facts_storage

what's the use case of these settings ?

Comment 23 Lukas Zapletal 2016-04-05 09:27:29 UTC
The name is now composed out of two settings:

discovery_prefix + discovery_hostname

Prefix can also be set to "" (empty) but in that case, discovery_hostname must always be unique and not start with number, otherwise provisioning can fail. Fact discovery_hostname can be comma separated list of facts, first wins.

New settings were demoed here: https://youtu.be/KuBW_-mUlpo?t=11m22s

Comment 25 Sachin Ghai 2016-04-05 09:38:02 UTC
Thanks Lukas for reply and demo link. However I don't see any setting with 'discovery_hostname' in webUI. Please see the attached screenshot.

Comment 26 Sachin Ghai 2016-04-05 09:38:49 UTC
Created attachment 1143724 [details]
discovery_hostname setting is missing in 6.2 beta snap6

Comment 29 Bryan Kearney 2016-04-05 10:09:04 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/9490 has been closed
-------------
Imri Zvik
Applied in changeset commit:foreman_discovery|1f4e985b05d4af9d05e361a0fa9bdcbea3bc8efc.

Comment 31 Sachin Ghai 2017-11-17 10:47:30 UTC
Verified with sat6.3 beta snap24. As per comment23, I can see following two settings for hostname

discovery_prefix 
discovery_hostname

Though, in UI, these setting are named as: 

discovery_prefix -> Hostname prefix
discovery_hostname -> Hostname_facts

Note: if you hover over mouse on above two settings starting w/ hostname_ then you will see the actual names starting discovery_.

In hammer settings are named as discovery_hostname + discovery_prefix

I set the Hostname_facts to "uuid" and Hostname prefix to "mac" and discovered a host. Host was discovered with name mac+uuid. Please see the screenshot.

In general, I filed couple of issues around validation as below:

https://bugzilla.redhat.com/show_bug.cgi?id=1470083
https://bugzilla.redhat.com/show_bug.cgi?id=1470987

Comment 32 Sachin Ghai 2017-11-17 10:49:18 UTC
Created attachment 1354107 [details]
defined hostname settings on UI

Comment 33 Sachin Ghai 2017-11-17 10:50:01 UTC
Created attachment 1354108 [details]
host discovered w/ hostname containing mac+uuid

Comment 34 Bryan Kearney 2018-02-21 17:09:24 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.

For information on the advisory, and where to find the updated files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336