Bug 1345723

Summary: Unregistering a client via CLI doesn't remove the profile from Satellite WebUI.
Product: Red Hat Satellite Reporter: Deepannagaraj Nagarathinam <dnagarat>
Component: katello-agentAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Adam Ruzicka <aruzicka>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: ahumbe, aruzicka, bbuckingham, cwelton, mmccune, mverma, xdmoon
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
URL: http://projects.theforeman.org/issues/15455
Whiteboard:
Fixed In Version: rubygem-katello-3.0.0.53-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:09:40 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 Deepannagaraj Nagarathinam 2016-06-13 04:08:49 UTC
Description of problem:

After unregistering a client through the CLI (subscription-manager unregister command) still the content hosts profile appears in the Satellite WebUI.

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

- Red Hat Satellite 6.2 Beta-2

How reproducible:

- Always

Steps to Reproduce:

1. Register a client to the Satellite server.

2. Unregister a client from the client CLI (subscription-manager unregister).

3. Navigate to the "content hosts" page in the Satellite WebUI and the profile remains undeleted. 

Actual results:

- The old profile still appears in the content hosts page.

Expected results:

- The content host profile should be removed from the content hosts page, after unregistering from the client.

Additional info:

- If we manually remove the profile, it will get deleted.

- And if we re-register the client again to the Satellite server, the same profile is updated (new content hosts entry is not created even if the content host is getting a new UUID).

- Even the hammer command output is also referring the old UUID.

Comment 1 Ashish Humbe 2016-06-13 11:49:06 UTC
After " # subscription-manager unregister" the system profile entry is not deleted from "Content Hosts" and "All Hosts" pages.

I see that the system entry is deleted from the katello_systems (foreman DB) and cp_consumer (candlepin DB) tables. But the host entry is not removed from the hosts table (foreman DB).

foreman=# select * from katello_systems;
 id | uuid | name | location | environment_id | created_at | updated_at | type | content_view_id | host_id 
----+------+------+----------+----------------+------------+------------+------+-----------------+---------
(0 rows)

foreman=# \c candlepin 
You are now connected to database "candlepin" as user "postgres".
candlepin=# select * from cp_consumer;
 id | created | updated | autoheal | entitlementstatus | name | servicelevel | username | uuid | environment_id | consumer_idcert_id | keypair_id | own
er_id | type_id | releasever | compliancestatushash | lastcheckin 
----+---------+---------+----------+-------------------+------+--------------+----------+------+----------------+--------------------+------------+----
------+---------+------------+----------------------+-------------
(0 rows)


Here is the entry I see for the client system in the "hosts" table: 


  3 | rhel7u2-2.gsslab.pnq2.redhat.com | 2016-06-13 05:56:47 | | 2016-06-13 05:57:04.395167 | 2016-06-13 05:19:50.535384 | 
  | 1 | 2 | | | | f | | | | 1 | | 
  3 | User | t | | f | | | | | | 
  | | 1 | 2 | Host::Managed | | | | | 
  | | | | 1 | fqdn=rhel7u2-2.gsslab.pnq2.redhat.com | |

Comment 3 Xixi 2016-06-16 02:11:31 UTC
Marking as Regression as "It worked perfectly in Sat6.1.9." per Ashish (thanks for raising this bug guys!)

Comment 4 Mike McCune 2016-06-16 05:22:31 UTC
there is no reason this bug should be private, making public

Comment 7 Justin Sherrill 2016-06-17 17:50:00 UTC
Connecting redmine issue http://projects.theforeman.org/issues/15455 from this bug

Comment 8 Bryan Kearney 2016-06-17 20:15:48 UTC
Upstream bug component is Client & Agent

Comment 9 Bryan Kearney 2016-06-21 16:16:24 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/15455 has been closed

Comment 10 Adam Ruzicka 2016-06-30 11:18:17 UTC
VERIFIED.
Sat 6.2 GA 18.1
tfm-rubygem-katello-3.0.0.54-1.el7sat.noarch

Running subscription-manager unregister with unregister_delete_host set to true in Settings/Katello causes the host and content host objects to be destroyed.

By default this setting is set to false and the host and content host objects are not removed on subscription-manager unregister. Re-registering the host causes an update of the existing host and content host objects

Comment 11 Bryan Kearney 2016-07-27 11:09:40 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:1501