Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1186537 - [RFE] Settings -> Discovered provide setting to specify fact to use for hostname
Summary: [RFE] Settings -> Discovered provide setting to specify fact to use for hostname
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Discovery Plugin
Version: Unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: orabin
QA Contact: Sachin Ghai
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-27 22:25 UTC by Paul Armstrong
Modified: 2019-09-26 17:39 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 17:09:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
proposed patch - models/setting/discovered.rb (1.26 KB, text/plain)
2015-01-28 03:21 UTC, Paul Armstrong
no flags Details
proposed patch - models/host/discovered.rb (3.94 KB, text/plain)
2015-01-28 03:22 UTC, Paul Armstrong
no flags Details
discovery_hostname setting is missing in 6.2 beta snap6 (74.92 KB, image/png)
2016-04-05 09:38 UTC, Sachin Ghai
no flags Details
defined hostname settings on UI (20.79 KB, image/png)
2017-11-17 10:49 UTC, Sachin Ghai
no flags Details
host discovered w/ hostname containing mac+uuid (26.68 KB, image/png)
2017-11-17 10:50 UTC, Sachin Ghai
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 9490 0 None None None 2016-04-22 15:13:51 UTC

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


Note You need to log in before you can comment on or make changes to this bug.