Bug 1482504

Summary: network.hostname-override defaults to "localhost" if no fqdn set
Product: Red Hat Satellite Reporter: James Slagle <jslagle>
Component: InstallationAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Sanket Jagtap <sjagtap>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.11CC: bbuckingham, brcoca, ehelms, greartes, inecas, sjagtap
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:37 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:

Description James Slagle 2017-08-17 12:39:43 UTC
When you install the generated katello-ca-consumer rpm from a satellite server, it sets the network.hostname-override to result of the "hostname -f" command.

If no fqdn or domain name is actually set on the system, then that command just returns "localhost".

When the system  is actually registered to satellite the host will be called localhost instead of the actual hostname (or short hostname if one is set). I actually have a set hostname on the system which could be used instead if not for the override fact being set:

[root@centos7 ~]# jq . /var/lib/rhsm/facts/facts.json | grep hostname
  "network.hostname": "centos7.localdomain",
  "network.hostname-override": "localhost",


Also, if you have 2 different systems that no fqdn set and you register them both to the same satellite, than only a single host is created in satellite called "localhost" and one registration just overwrites the other one.

Would it be possible to default to "hostname" if "hostname -f" returns localhost?

Should hosts created in satellite be overwriting one another if they only share the value of "localhost" for their fqdn?

Comment 1 Ivan Necas 2017-08-18 12:37:55 UTC
The functionality to match the host against the hostname if it already exists is there on purpose, to make it possible to match provisioned host with the one registered with subscription manager.

Changing the component to installer, since that's where the katello-ca-consumer rpm is generated.

Comment 2 Ivan Necas 2017-08-18 12:50:27 UTC
Created redmine issue http://projects.theforeman.org/issues/20642 from this bug

Comment 3 Satellite Program 2017-08-23 22:02:01 UTC
Upstream bug assigned to inecas

Comment 4 Satellite Program 2017-08-23 22:02:04 UTC
Upstream bug assigned to inecas

Comment 6 Satellite Program 2017-08-30 20:01:56 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20642 has been resolved.

Comment 7 Ivan Necas 2017-09-07 06:04:52 UTC
Putting to assigned, as there was also fix on server side to handle the situation better

Comment 8 Satellite Program 2017-09-07 08:20:38 UTC
Upstream bug assigned to jsherril

Comment 9 Satellite Program 2017-09-07 08:20:41 UTC
Upstream bug assigned to jsherril

Comment 10 Satellite Program 2017-09-07 14:20:39 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20816 has been resolved.

Comment 11 Sanket Jagtap 2017-12-11 16:31:46 UTC
Bug : Satellite 6.3.0 snap28

[root@bkr-hv01-guest27 ~]# hostname
localhost
[root@bkr-hv01-guest27 ~]# hostname -f
localhost

nslookup 10.19.XX.XX
Server:		
Address:	#53

Non-authoritative answer:
aaa.in-addr.arpa	
name = bkr-hv01-guest27.com.

 subscription-manager register --org="Default_Organization" --activationkey="ak-rhel-7"
The system has been registered with ID: 8dc7d3ac-4d2b-4656-9d49-60dabcad49d7 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@bkr-hv01-guest27 ~]# subscription-manager facts --list | grep hostname
network.hostname: localhost
network.hostname-override: bkr-hv01-guest27.com

ID | NAME                                                   | OPERATING SYSTEM | HOST GROUP              | IP           | MAC               | CONTENT VIEW | LIFECYCLE ENVIRONMENT
---|--------------------------------------------------------|------------------|-------------------------|--------------|-------------------|--------------|----------------------
6  | bkr-hv01-guest27.com           | RedHat 7.4       |                         | 10.19.XXXXX | 00:16:3eXXXXXX | RHEL 7 CV    | DEV

Comment 12 Satellite Program 2018-02-21 16:54:37 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