Bug 1995279 - The katello-ca-consumer is not being removed when the force option is checked in the 'Advanced' tab under Hosts -> Register Host
Summary: The katello-ca-consumer is not being removed when the force option is checked...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.10.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: 6.10.0
Assignee: satellite6-bugs
QA Contact: Stephen Wadeley
URL:
Whiteboard:
: 1993742 (view as bug list)
Depends On: 2006827
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-08-18 17:55 UTC by Rafael Cavalcanti
Modified: 2021-11-16 14:13 UTC (History)
4 users (show)

Fixed In Version: foreman-2.5.2.6-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 14:13:21 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 33305 0 None None None 2021-08-23 14:48:01 UTC
Red Hat Product Errata RHSA-2021:4702 0 None None None 2021-11-16 14:13:33 UTC

Description Rafael Cavalcanti 2021-08-18 17:55:26 UTC
Description of problem:
Trying to register a host(already register to another Satellite) by going to Hosts -> Register Host and check the 'force' option in 'Advanced' tab is failing as the katello-ca-consumer installed is not being removed.

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


How reproducible:
100%

Steps to Reproduce:
1. Satellite webUI -> Hosts -> Register Host
2. Fill the fields and in the 'Advanced' tab check the 'Force' options
3. Register the host with the registration command generated

Actual results:
The registration command does not remove the katello-ca-consumer packages.
The 'Force' option is supposed to:
---
 "Remove any `katello-ca-consumer` rpms before registration and run subscription-manager with `--force` argument."
--
The script seems to look for this 'katello-ca-consumer-latest.noarch.rpm' and can't find a package with this name installed.
Expected results:
Remove the katello-ca-consumer and install a new one. Otherwise, the transaction will conflict:
---
Transaction check error:
  file /usr/bin/katello-rhsm-consumer from install of katello-ca-consumer-rguerra-sat610.rguerra.lab-1.0-1.noarch conflicts with file from package katello-ca-consumer-rguerra-cap610.rguerra.lab-1.0-1.noarch

Error Summary
---


Additional info:
From my LAB:
---
1. Register the system to a satellite server:
[root@rhel7-02 ~]# subscription-manager register --org="ACME" --activationkey="ak-rhel7-library" --force
The system has been registered with ID: 2d9c0316-717d-4422-91b0-c2761c87b84a
The registered system name is: rhel7-02.rguerra.lab
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@rhel7-02 ~]# rpm -qa |grep katello-ca
katello-ca-consumer-janga.rguerra.lab-1.0-9.noarch


2. Run the script generated on another Satellite:
[root@rhel7-02 ~]# curl -sS --insecure 'https://rguerra-sat610.rguerra.lab:9090/register?activation_keys=ak-rhel7&force=true&lifecycle_environment_id=2&location_id=2&operatingsystem_id=1&organization_id=1&update_packages=false' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJpYXQiOjE2MjkzMDY2ODMsImp0aSI6ImFjMTdhNmNkMTI4MmFkY2RiYzExNzkxMTVlNDEyMmI3ZDI0MTNjY2VlYmU4MDM3YjFjZjBjYmNhYTFmOTM2NDQiLCJleHAiOjE2MjkzMjEwODMsInNjb3BlIjoicmVnaXN0cmF0aW9uI2dsb2JhbCByZWdpc3RyYXRpb24jaG9zdCJ9.goxamrSaQs63-Jjd4HwofckTk9eAIR2dza2YTjE3fiM' | bash
#
# Running registration
#
Loaded plugins: enabled_repos_upload, package_upload, product-id, search-disabled-repos, subscription-manager
No Match for argument: katello-ca-consumer-latest.noarch.rpm
No Match for argument: katello-ca-consumer-latest.noarch.rpm.1
No Match for argument: katello-ca-consumer-latest.noarch.rpm.2
No Match for argument: katello-ca-consumer-latest.noarch.rpm.3
No Match for argument: katello-ca-consumer-latest.noarch.rpm.4
No Packages marked for removal
Uploading Enabled Repositories Report
WARNING:dnf:Failed to synchronize cache for repo 'rhel-7-server-satellite-tools-6.7-rpms', ignoring this repo.
WARNING:dnf:Failed to synchronize cache for repo 'rhel-7-server-rpms', ignoring this repo.
WARNING:dnf:Failed to synchronize cache for repo 'rhel-7-server-ansible-2.9-rpms', ignoring this repo.
Loaded plugins: enabled_repos_upload, package_upload, product-id, search-disabled-repos, subscription-manager
Examining /tmp/tmp.NtMfIcwnfG.rpm: katello-ca-consumer-rguerra-sat610.rguerra.lab-1.0-1.noarch
Marking /tmp/tmp.NtMfIcwnfG.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package katello-ca-consumer-rguerra-sat610.rguerra.lab.noarch 0:1.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================
 Package                                                                  Arch                             Version                           Repository                                 Size
=============================================================================================================================================================================================
Installing:
 katello-ca-consumer-rguerra-sat610.rguerra.lab                           noarch                           1.0-1                             /tmp.NtMfIcwnfG                            20 k

Transaction Summary
=============================================================================================================================================================================================
Install  1 Package

Total size: 20 k
Installed size: 20 k
Downloading packages:
Running transaction check
Running transaction test


Transaction check error:
  file /usr/bin/katello-rhsm-consumer from install of katello-ca-consumer-rguerra-sat610.rguerra.lab-1.0-1.noarch conflicts with file from package katello-ca-consumer-janga.rguerra.lab-1.0-9.noarch

Error Summary
-------------

Uploading Enabled Repositories Report
WARNING:dnf:Failed to synchronize cache for repo 'rhel-7-server-satellite-tools-6.7-rpms', ignoring this repo.
WARNING:dnf:Failed to synchronize cache for repo 'rhel-7-server-rpms', ignoring this repo.
WARNING:dnf:Failed to synchronize cache for repo 'rhel-7-server-ansible-2.9-rpms', ignoring this repo.
Unregistering from: janga.rguerra.lab:8443/rhsm
The system with UUID 2d9c0316-717d-4422-91b0-c2761c87b84a has been unregistered
All local data removed
HTTP error (404 - Not Found): Couldn't find activation key 'ak-rhel7'  <<<<< This is due to the katello-ca-consumer installed at the first registration.


3. Check the registration and package installed:
---
[root@rhel7-02 ~]# subscription-manager identity ; rpm -qa |grep katello-ca-consumer
This system is not yet registered. Try 'subscription-manager register --help' for more information.
katello-ca-consumer-janga.rguerra.lab-1.0-9.noarch
---

Comment 1 Stephen Wadeley 2021-08-18 18:44:55 UTC
Hello

see also:
Bug 1993742 - Force option in registration template does not remove an existing katello-ca-consumer as mentioned in the info message beside

Comment 3 wclark 2021-08-23 14:48:02 UTC
Attached Redmine https://projects.theforeman.org/issues/33305

Thanks Rafael for creating the upstream issue and PR!

Comment 4 wclark 2021-08-23 14:49:45 UTC
*** Bug 1993742 has been marked as a duplicate of this bug. ***

Comment 10 Stephen Wadeley 2021-09-22 18:44:37 UTC
Hello

consumer cert is now removed but registration fails later due to:

Unable to verify server's identity: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:897)


Will be fixed in:


Bug 2006827 - Run 'subscription-manager clean' when force=true

thank you

Comment 13 errata-xmlrpc 2021-11-16 14:13:21 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 (Moderate: Satellite 6.10 Release), 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-2021:4702


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