Bug 2084106

Summary: satellite-change-hostname on capsule runs deprecated capsule-installer
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: satellite-change-hostnameAssignee: Evgeni Golov <egolov>
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.11.0CC: ehelms, pcreech
Target Milestone: 6.11.0Keywords: AutomationBlocker, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: katello-4.3.0-2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2085082 (view as bug list) Environment:
Last Closed: 2022-07-05 14:35:32 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 Lukas Pramuk 2022-05-11 12:24:21 UTC
Description of problem:
satellite-change-hostname on capsule runs deprecated capsule-installer

Version-Release number of selected component (if applicable):
6.11.0 Snap19
satellite-common-6.11.0-0.11.beta.el7sat.noarch
katello-common-4.3.0-1.el7sat.noarch

How reproducible:
deterministic

Steps to Reproduce:
1.Run satellite-change-hostname on capsule

# satellite-change-hostname new-sat.example.com -u admin -p changeme -c /root/new-sat.example.com-certs.tar -y
Checking for certs tarball

Checking hostname validity
updating hostname in /etc/hostname
setting hostname
checking if hostname was changed
stopping services
removing old cert rpms
No Match for argument: sat.example.com-apache*
No Match for argument: sat.example.com-foreman-client*
No Match for argument: sat.example.com-foreman-proxy*
No Match for argument: sat.example.com-foreman-proxy-client*
No Match for argument: sat.example.com-puppet-client*
No Match for argument: sat.example.com-qpid-broker*
No Match for argument: sat.example.com-qpid-client-cert*
No Match for argument: sat.example.com-qpid-router-client*
No Match for argument: sat.example.com-qpid-router-server*
No Match for argument: sat.example.com-tomcat*
deleting old certs
backed up /var/www/html/pub to /var/www/html/pub/sat.example.com-20220511061913.backup
updating hostname in /etc/hosts
updating hostname in foreman installer scenarios
backing up last_scenario.yaml
removing last_scenario.yaml
re-running the installer
capsule-installer --scenario capsule -v --disable-system-checks --foreman-proxy-register-in-foreman false --certs-tar-file /root/new-sat.example.com-certs.tar
restoring last_scenario.yaml
cleaning up temporary files
ERROR: capsule-installer is no longer used.  Please use 'satellite-installer --scenario capsule'.
       For more information on available options, include '--help'.

  Something went wrong with the Capsule installer.
  Please check the above output and the corresponding logs.
  
  Once the issue is resolved you may complete the hostname change by running: 'capsule-installer --scenario capsule -v --disable-system-checks'
  and completing the following steps:
You will have to update the Name and URL of the Smart Proxy in Capsule to the new hostname.



Failed 'capsule-installer --scenario capsule -v --disable-system-checks --foreman-proxy-register-in-foreman false --certs-tar-file /root/new-sat.example.com-certs.tar' with exit code 1

Actual results:
tool doesn't work on capsule (capsule-installer was on 6.1)

Expected results:
tool works on capsule successfully

Additional info:
/usr/sbin/katello-change-hostname:15: proxy_hyphenated: "foreman-proxy-content",
/usr/sbin/satellite-change-hostname:15: proxy_hyphenated: "capsule",

/usr/share/katello/hostname-change.rb:36:
    def get_default_program
      case @last_scenario
      when "katello"
        return "foreman"
      when @proxy_hyphenated
        return "foreman"           <- this is expected 
      else
        return @last_scenario      <- this is actual result
      end
    end

# ll /etc/foreman-installer/scenarios.d/last_scenario.yaml
lrwxrwxrwx. 1 root root 47 May 11 08:02 /etc/foreman-installer/scenarios.d/last_scenario.yaml -> /etc/foreman-installer/scenarios.d/capsule.yaml

>>> capsule-installer is tried as default_program = capsule and script then runs {@options[:program]}-installer

Comment 1 Lukas Pramuk 2022-05-11 12:30:25 UTC
There is a workaround to symlink capsule-installer to satellite-installer

# mv /usr/sbin/capsule-installer{,.orig}
# ln -s satellite-installer /usr/sbin/capsule-installer

Comment 2 Evgeni Golov 2022-05-11 14:33:55 UTC
Created redmine issue https://projects.theforeman.org/issues/34896 from this bug

Comment 3 Bryan Kearney 2022-05-11 16:04:58 UTC
Upstream bug assigned to egolov

Comment 4 Bryan Kearney 2022-05-11 16:05:00 UTC
Upstream bug assigned to egolov

Comment 6 Lukas Pramuk 2022-05-23 10:02:04 UTC
VERIFIED.

@Satellite 6.11.0 Snap21
katello-common-4.3.0-2.el7sat.noarch

by the following manual reproducer:

1) @Satellite: Generate capsule certs for the new hostname and copy it to capsule

# capsule-certs-generate --foreman-proxy-fqdn capsule-new.example.com --certs-tar capsule-new.example.com-certs.tar 

# scp capsule-new.example.com-certs.tar capsule.example.com:/root


2) @Capsule: Create /etc/hosts record and run satellite-change-hostname

# echo 127.0.0.1 capsule-new.example.com > /etc/hosts

# satellite-change-hostname capsule-new.example.com -u admin -p changeme -c /root/capsule-new.example.com-certs.tar -y
Checking for certs tarball

Checking hostname validity
updating hostname in /etc/hostname
setting hostname
checking if hostname was changed
stopping services
removing old cert rpms
No Match for argument: capsule.example.com-apache*
No Match for argument: capsule.example.com-foreman-client*
No Match for argument: capsule.example.com-foreman-proxy*
No Match for argument: capsule.example.com-foreman-proxy-client*
No Match for argument: capsule.example.com-puppet-client*
No Match for argument: capsule.example.com-qpid-broker*
No Match for argument: capsule.example.com-qpid-client-cert*
No Match for argument: capsule.example.com-qpid-router-client*
No Match for argument: capsule.example.com-qpid-router-server*
No Match for argument: capsule.example.com-tomcat*
deleting old certs
backed up /var/www/html/pub to /var/www/html/pub/capsule.example.com-20220523054123.backup
updating hostname in /etc/hosts
updating hostname in foreman installer scenarios
backing up last_scenario.yaml
removing last_scenario.yaml
re-running the installer
foreman-installer --scenario capsule -v --disable-system-checks --foreman-proxy-register-in-foreman false --certs-tar-file /root/capsule-new.example.com-certs.tar
cleaning up temporary files
2022-05-23 05:41:30 [NOTICE] [root] Loading installer configuration. This will take some time.
2022-05-23 05:41:36 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2022-05-23 05:41:36 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
2022-05-23 05:41:43 [WARN  ] [pre] Skipping system checks.
2022-05-23 05:41:43 [WARN  ] [pre] Skipping system checks.
2022-05-23 05:41:48 [NOTICE] [configure] Starting system configuration.
2022-05-23 05:41:58 [NOTICE] [configure] 250 configuration steps out of 1226 steps complete.
2022-05-23 05:42:07 [NOTICE] [configure] 500 configuration steps out of 1231 steps complete.
2022-05-23 05:42:08 [NOTICE] [configure] 750 configuration steps out of 1231 steps complete.
2022-05-23 05:42:09 [NOTICE] [configure] 1000 configuration steps out of 1235 steps complete.
2022-05-23 05:42:41 [NOTICE] [configure] System configuration has finished.
  Success!
  * Capsule is running at https://capsule-new.example.com:9090

  The full log is at /var/log/foreman-installer/capsule.log
Restarting puppet services
**** Hostname change complete! ****
IMPORTANT:
You will have to update the Name and URL of the Smart Proxy in Foreman to the new hostname.

>>> satellite-change-hostname on capsule runs correct installer script (foreman-installer)

Comment 9 errata-xmlrpc 2022-07-05 14:35:32 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.11 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-2022:5498