Bug 1677872

Summary: Restarting the satellite services is complaining about admin password in hammer configuration
Product: Red Hat Satellite Reporter: Kenny Tordeurs <ktordeur>
Component: Satellite MaintainAssignee: Anurag Patel <apatel>
Status: CLOSED ERRATA QA Contact: Gaurav Talreja <gtalreja>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5.0CC: apatel, egolov, inecas, jpathan, kgaikwad, mbacovsk, mkalyat, rjerrido, supatil
Target Milestone: 6.9.0Keywords: Triaged, UserExperience
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-foreman_maintain-0.4.5 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-21 14:48:22 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:
Bug Depends On: 1897360, 1925616    
Bug Blocks:    

Description Kenny Tordeurs 2019-02-16 14:23:52 UTC
Description of problem:

Restarting the satellite services is complaining about admin password in hammer configuration:

# whoami
~~~
root
~~~

# foreman-maintain service restart
~~~
Running preparation steps required to run the next scenarios
================================================================================
Setup hammer: 
Configuring Hammer CLI...
Hammer admin password: 
                                                                      [FAIL]
Hammer configuration failed: Is the admin password correct? (it was stored in /etc/foreman-maintain/foreman-maintain-hammer.yml)Is the server down?
--------------------------------------------------------------------------------
Scenario [preparation steps required to run the next scenarios] failed.

The following steps ended up in failing state:

  [hammer-setup]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist="hammer-setup"
~~~

Also not sure about the combination that should be used to whitelist the hammer-setup:

# foreman-maintain service restart --whitelist="hammer-setup"
~~~
ERROR: Unrecognised option '--whitelist'

See: 'foreman-maintain service restart --help'
~~~

# cat /etc/foreman-maintain/foreman-maintain-hammer.yml
~~~
---
:foreman:
  :username: admin
  :password: password
~~~

[root@ktordeur-sat65 ~]# hammer -u admin -p password host list
~~~
---|-----------------------------------------------|------------------|---------------|---------------|-------------------|---------------|----------------------|----------------------
ID | NAME                                          | OPERATING SYSTEM | HOST GROUP    | IP            | MAC               | GLOBAL STATUS | CONTENT VIEW         | LIFECYCLE ENVIRONMENT
---|-----------------------------------------------|------------------|---------------|---------------|-------------------|---------------|----------------------|----------------------
4  | floyd-mclaird.sysmgmt.lan                     | RHEL Server 7.6  | RHEL7 clients | 192.168.1.138 | 52:54:00:eb:bf:06 | Warning       | RHEL7 Server Clients | Library              
2  | ktordeur-capsule-sat65.sysmgmt.lan            | RHEL Server 7.6  |               | 10.37.193.179 | 52:54:00:70:09:0b | Warning       | CAPSULE              | Library              
1  | ktordeur-sat65.sysmgmt.lan                    | RHEL Server 7.6  |               | 192.168.1.2   | 52:54:00:e1:c9:9b | OK            |                      |                      
3  | virt-who-dell-r440-05.gsslab.brq.redhat.com-1 |                  |               |               |                   | OK            |                      |                      
---|-----------------------------------------------|------------------|---------------|---------------|-------------------|---------------|----------------------|----------------------
~~~

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

How reproducible:
100%

Steps to Reproduce:
1. # foreman-maintain service restart
2.
3.

Actual results:
hammer configuration error for password

Expected results:
Services to be restarted without any hammer config as we are root user

Additional info:
This issue does not happen if we authenticate first with `hammer auth login`

[root@ktordeur-sat65 ~]# hammer auth login
[Foreman] Username: admin
[Foreman] Password for admin: 
Successfully logged in as 'admin'.


[root@ktordeur-sat65 ~]# foreman-maintain service restart
Running Restart Services
================================================================================
Check if command is run as root user:                                 [OK]
--------------------------------------------------------------------------------
Restart applicable services: 
Stopping the following service(s):
...

Comment 3 Nikhil Kathole 2019-06-18 08:54:48 UTC
Similar to https://bugzilla.redhat.com/show_bug.cgi?id=1696862

Comment 6 Gaurav Talreja 2020-12-30 08:12:07 UTC
Verified.

Tested on the latest Satellite 6.9.0 snap 7.0, where blocker candlepin issue was not observed.
Version: rubygem-foreman_maintain-0.7.0-1.el7sat.noarch

Steps:

1. Have invalid passwords in .hammer/cli.modules.d/foreman.yml and /etc/foreman-installer/scenarios.d/satellite-answers.yaml
2. Run "foreman-maintain health check", which prompts for hammer password and generates file /etc/foreman-maintain/foreman-maintain-hammer.yml
3. Have an invalid password in /etc/foreman-maintain/foreman-maintain-hammer.yml
4. Run "foreman-maintain service restart" and all services restart successfully without asking for a hammer password.

Comment 9 errata-xmlrpc 2021-04-21 14:48:22 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 (Satellite 6.9 Satellite Maintenance 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/RHBA-2021:1312