Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1356714 - After upgrade, all of my hosts are duplicated one with shortname, one with fqdn
Summary: After upgrade, all of my hosts are duplicated one with shortname, one with fqdn
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Hosts
Version: 6.2.0
Hardware: x86_64
OS: Linux
high
high vote
Target Milestone: 6.2
Assignee: satellite6-bugs
QA Contact: jcallaha
URL:
Whiteboard:
: 1362592 (view as bug list)
Depends On:
Blocks: CEE_Sat6_Top_BZs, GSS_Sat6_Top_Bugs 1380473 1394349 1405538
TreeView+ depends on / blocked
 
Reported: 2016-07-14 20:20 UTC by rakesh kumar
Modified: 2018-12-06 20:49 UTC (History)
28 users (show)

Fixed In Version: rubygem-katello-3.0.0.80 foreman-1.11.0.54-1,katello-installer-base-3.0.0.69-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1380473 1405538 (view as bug list)
Environment:
Last Closed: 2017-01-26 15:55:05 UTC
Target Upstream Version:


Attachments (Terms of Use)
unify_hosts.rake (deleted)
2016-08-23 12:58 UTC, Justin Sherrill
no flags Details
hosts page (deleted)
2016-09-29 16:13 UTC, jcallaha
no flags Details
duplicate (deleted)
2016-09-29 18:10 UTC, jcallaha
no flags Details
combined (deleted)
2016-09-29 18:12 UTC, jcallaha
no flags Details


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 14516 None None None 2016-08-24 17:46:31 UTC
Foreman Issue Tracker 16270 None None None 2016-08-24 17:46:48 UTC
Red Hat Knowledge Base (Solution) 2482641 None None None 2016-08-09 14:01:56 UTC
Red Hat Product Errata RHBA-2016:1993 normal SHIPPED_LIVE Satellite 6.2.2 Async Bug Release 2016-10-04 10:43:20 UTC

Internal Links: 1367126 1367128

Description rakesh kumar 2016-07-14 20:20:56 UTC
Description of problem:
Puppet creates Duplicate  profile in "All hosts" with FQDN if client is configured and registered with short name.

Version-Release number of selected component (if applicable):
Satellite 6.2 beta 2

How reproducible:
Always

Steps to Reproduce:
1.Change the client hostname to shortname instead of FQDN( # hostname and #hostname -f o/p should be different)
2.Register the same to Satellite
3.Then, installed the puppet agent and make necessary changes to /etc/puppet/puppet.conf 
4.Create the puppet client certificate by executing "puppet agent -t" and signed it in Satellite.
5. Again, execute below command on the client:
---
# puppet agent -t

Actual results: After performing above steps there were two client profiles in "All hosts" one is with short name and one is with FQDN.


Expected results: Puppet should not create new profile with FQDN.


Additional info:

Workaround: We can mention parameter "certname=<client shortname>" in /etc/puppet/puppet.conf than puppet will not create profile FQDN

Comment 3 Ivan Necas 2016-08-04 10:36:05 UTC
@jsherrill seems like related to https://bugzilla.redhat.com/show_bug.cgi?id=1362592, should we tread this as one BZ and close a dupe?

Comment 4 Justin Sherrill 2016-08-04 12:40:25 UTC
Ivan, 

Yeah I agree these are duplicates.  Closing https://bugzilla.redhat.com/show_bug.cgi?id=1362592

-Justin

Comment 5 Justin Sherrill 2016-08-04 12:40:47 UTC
*** Bug 1362592 has been marked as a duplicate of this bug. ***

Comment 10 Justin Sherrill 2016-08-15 15:54:51 UTC
Opened subscription-manager bugs for long term support:

https://bugzilla.redhat.com/show_bug.cgi?id=1367128
https://bugzilla.redhat.com/show_bug.cgi?id=1367126

Comment 11 Justin Sherrill 2016-08-19 20:10:11 UTC
Temporary workaround for new registrations:

run the following on a client prior to registration:


if [ -d /etc/rhsm/facts/ ]; then
  echo "{\"network.hostname\":\"`hostname -f`\"}" > /etc/rhsm/facts/katello.facts
fi


We are in the process of coming up with a more permanent work around as well as a script to 'unify' systems that are duplicated after upgrade

Comment 14 Justin Sherrill 2016-08-23 12:58:12 UTC
Created attachment 1193310 [details]
unify_hosts.rake

Comment 16 Mike McCune 2016-08-24 13:55:57 UTC
Attaching our script for unifying the hosts duplicated after upgrade:

Place in 'unify_hosts.rake' in /usr/share/foreman/lib/tasks/ and run:

# foreman-rake unify_hosts

NOTE: IT IS HIGHLY RECOMMENDED THE CUSTOMER HAVE A FULL DB BACKUP

With the testing we have done on 1 customer's db, it seemed to have unified 98% of the duplicate hosts.  The only times it did not was when it seemed the fqdn host had been re-registered (likely the customer doing it manually).  Those associated shortname hosts will need to be cleaned up manually.

Comment 17 Bryan Kearney 2016-08-24 18:17:32 UTC
Upstream bug assigned to jsherril@redhat.com

Comment 18 Bryan Kearney 2016-08-24 18:17:36 UTC
Upstream bug component is Infrastructure

Comment 19 Bryan Kearney 2016-08-24 18:17:41 UTC
Upstream bug assigned to jsherril@redhat.com

Comment 21 Bryan Kearney 2016-09-06 18:17:29 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16270 has been resolved.

Comment 22 Ohad Levy 2016-09-15 12:45:18 UTC
*** Bug 1375706 has been marked as a duplicate of this bug. ***

Comment 23 Christian Pearce 2016-09-21 12:55:01 UTC
Is this target milestone correct?  I thought 6.2.2 is out.

Comment 27 Mike McCune 2016-09-28 20:31:50 UTC
Christian:

We are shipping an errata in between 6.2.2 and 6.2.3 to include this and a few other fixes that are landing outside our normally scheduled 6.2.Z 30-day release cycle.

Comment 30 jcallaha 2016-09-29 16:13:17 UTC
Created attachment 1205982 [details]
hosts page

Comment 31 Justin Sherrill 2016-09-29 17:17:31 UTC
The purpose of this BZ is to only handle the situation where a user has found themselves in after upgrading and having all hosts duplicated.  As part of this we are shipping a rake task that can be run (basically the same task as attached to this bug).   

I have cloned this bz to a new bug to handle new registrations (https://bugzilla.redhat.com/show_bug.cgi?id=1380473), and it is also targeting a 6.2.z release.  

In the meantime as has been stated, you can simply run this:


if [ -d /etc/rhsm/facts/ ]; then
  echo "{\"network.hostname\":\"`hostname -f`\"}" > /etc/rhsm/facts/katello.facts
fi

prior to registration to resolve the issue for new registrations.  This can be added to a bootstrap script, kickstart file, or puppet module.  Please do let us know if this workaround is not sufficient until 1380473 can be released.

Comment 32 jcallaha 2016-09-29 18:10:11 UTC
Verified in Satellite 6.2.2 Snap 1.

After duplicating the hosts as outlined in the setup steps (see attached image). I ran the unify_hosts job and the two entries were successfully combined (see unified image).

[root@rhsm-qe-1 ~]# foreman-rake  katello:unify_hosts
Skipping virt-who-supermicro-2027gr-tr2-1.gsslab.rdu2.redhat.com-1 due to blank primary interface mac
Skipping virt-who-inorbit.hq.gsslab.rdu.redhat.com-1 due to blank primary interface mac
Skipping virt-who-bulgaria.hq.gsslab.rdu.redhat.com-1 due to blank primary interface mac
Skipping virt-who-nightwing.hq.gsslab.rdu.redhat.com-1 due to blank primary interface mac
Unifying mgmt4.rhq.lab.eng.bos.redhat.com with mgmt4

Comment 33 jcallaha 2016-09-29 18:10:41 UTC
Created attachment 1205991 [details]
duplicate

Comment 34 jcallaha 2016-09-29 18:12:00 UTC
Created attachment 1205992 [details]
combined

Comment 37 errata-xmlrpc 2016-10-04 06:43:57 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/RHBA-2016:1993

Comment 38 sthirugn@redhat.com 2016-11-17 23:16:54 UTC
Negative.  This issue is still happening in Satellite 6.2.4.

Case #01713467

Comment 41 Bryan Kearney 2016-11-18 01:08:01 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16270 has been resolved.

Comment 42 Julio Entrena Perez 2016-11-18 11:59:00 UTC
(In reply to sthirugn@redhat.com from comment #38)
> Negative.  This issue is still happening in Satellite 6.2.4.

This BZ provides the unify_hosts.rake script that removes already existing duplicates.
The script is provided by this errata and works, therefore CLOSED ERRATA is imho correct.

The prevention of new duplicates is not covered by this bug.

Comment 43 sthirugn@redhat.com 2016-11-18 12:55:37 UTC
(In reply to Julio Entrena Perez from comment #42)
> (In reply to sthirugn@redhat.com from comment #38)
> > Negative.  This issue is still happening in Satellite 6.2.4.
> 
> This BZ provides the unify_hosts.rake script that removes already existing
> duplicates.
> The script is provided by this errata and works, therefore CLOSED ERRATA is
> imho correct.
> 
> The prevention of new duplicates is not covered by this bug.

I agree that this bug creates a workaround.  But I am looking for a fix to prevent this in the first place.

I am ok if this issue needs to be tracked in this bug or a new bug - regardless a fix is needed soon.

Comment 44 Justin Sherrill 2016-11-18 15:17:34 UTC
We could pretty easily add this as a post step in the upgrade process.  I think that is safer than trying to modify the existing migrations as that migration is extremely fragile and has been working really well.  This script has been tested really well so far.  So my vote would be to just run this as a post script in the installer upgrade.

Comment 46 Justin Sherrill 2016-11-30 14:10:15 UTC
Technically this already went into out in 6.2.2.  What suresh is suggesting is to run the script automatically upon upgrade.  I'll open a PR for that now

Comment 47 Justin Sherrill 2016-11-30 14:32:51 UTC
PR Opened here: https://gitlab.sat.lab.tlv.redhat.com/satellite6/katello-installer/merge_requests/76

There is some concern because this will get run for all current users.  Given that the default behavior is to use mac addresses for the unification, its unlikely to cause a problem but it is a concern.

Comment 48 Julio Entrena Perez 2016-11-30 16:19:28 UTC
IHAC reporting that running "foreman-rake katello:unify_hosts" results in all host entries being unified (expected) but then these hosts don't show any subscriptions or installed products. 
Running "subscription-manager refresh" in the hosts results in "Couldn't find consumer":

[root@hostname ~]# subscription-manager refresh
Couldn't find consumer 'bd9a911d-6fd2-4ce5-a9d1-f36652a54a8d'

They have workarounded that by explicitly creating file /etc/rhsm/facts/katello.facts with the correct network.hostname entry which prevents the duplicates.

I assume that running the script on a satellite with no duplicates would be a no op?

Comment 49 jcallaha 2017-01-16 20:27:53 UTC
Verified in Satellite 6.2.7 Snap 1. The unify hosts task is now included at the end of the upgrade.

Upgrade Step: unify_hosts (this may take a while) ...
Skipping virt-who-supermicro-2027gr-tr2-1.gsslab.rdu2.redhat.com-1 due to blank primary interface mac
Skipping virt-who-bulgaria.hq.gsslab.rdu.redhat.com-1 due to blank primary interface mac
Skipping virt-who-inorbit.hq.gsslab.rdu.redhat.com-1 due to blank primary interface mac
Skipping virt-who-ironforge.satellite.lab.eng.rdu2.redhat.com-1 due to blank primary interface mac
Skipping virt-who-nightwing.hq.gsslab.rdu.redhat.com-1 due to blank primary interface mac
Skipping virt-who-dhcp-8-101-249.satellite.lab.eng.rdu2.redhat.com-1 due to blank primary interface mac
Unifying test with test.short.hostname.com

Upgrade completed!

Comment 50 Bryan Kearney 2017-01-26 15:55:05 UTC
This was delivered in satellite 6.2.7 (https://access.redhat.com/errata/RHBA-2017:0197)

Comment 51 Luke Rawlins 2017-05-05 01:00:09 UTC
foreman-rake katello:unify_hosts will attempt to shutdown and delete virtual machines if they are not dissociated from the satellite server prior to running the script. If you have a compute node attached this can be dangerous. I've been using --name with the fqdn for new host registrations to avoid duplicate enteries.


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