Bug 1563857

Summary: [RFE] Proactively check and correct the host setting under cli_config.yml to use fqdn instead of localhost
Product: Red Hat Satellite Reporter: Christian Marineau <cmarinea>
Component: Foreman MaintainAssignee: Amit Upadhye <aupadhye>
Status: CLOSED WORKSFORME QA Contact: Nikhil Kathole <nkathole>
Severity: high Docs Contact:
Priority: medium    
Version: 6.3.0CC: apatel, aupadhye, bkearney, inecas, kgaikwad, smajumda
Target Milestone: UnspecifiedKeywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-28 13:39:16 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:

Description Christian Marineau 2018-04-04 22:57:01 UTC
Description of problem:
When cli_config.yml was previously configured by the user to use localhost to resolves the Satellite url, hammer will fails after the initial upgrade step, for the same cause then this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1454706

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

How reproducible:
100%

Steps to Reproduce:
1. Configure the following file /root/.hammer/cli_config.yml to use localhost:
:foreman:
    :host: 'https://localhost/'
    :username: 'admin'
    :password: 'changeme'
    :request_timeout: 300

2. Run hammer ping, 
   # hammer ping                                           
   SSL error: hostname "localhost" does not match the server certificate

   Or run foreman-maintain, the following error will be thrown:
   Check whether all services are running using hammer ping:             [FAIL]
   SSL error: hostname "localhost" does not match the server certificate


Actual results:
  Upgrading Satellite from 6.2 to 6.3 will causes some hammer configuration to be broken and will prevent some upgrade steps to complete with success since any step using hammer commands will fails with an SSL errror.


Expected results:
  We may have foreman-maintain to check the syntax of cli_config.yml, then throws a Warning and ask the user if foreman-maintain can update the configuration right away to use the fqdn, and thus prevent further issue in the installation process and with the usage of hammer cli.

Additional info:
See the following bug https://bugzilla.redhat.com/show_bug.cgi?id=1454706
See the following KCS: https://access.redhat.com/solutions/3364391

Note: We may also consider to bypass any cli_config.yml configured by the user since any syntax error may cause issue with any hammer commands.

Comment 2 Kavita 2018-05-11 06:07:30 UTC
Created redmine issue http://projects.theforeman.org/issues/23563 from this bug