Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1422236

Summary: Bootstrap fails with traceback if it cannot find the Foreman SSH Key
Product: Red Hat Satellite Reporter: Rich Jerrido <rjerrido>
Component: BootstrapAssignee: Rich Jerrido <rjerrido>
Status: CLOSED ERRATA QA Contact: Sanket Jagtap <sjagtap>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.7CC: bbuckingham, ehelms, jcallaha, rjerrido, sjagtap, zhunting
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: katello-client-bootstrap-1.3.0-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1426421 (view as bug list) Environment:
Last Closed: 2017-05-01 14:00:01 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:    
Bug Blocks: 1426421    

Description Rich Jerrido 2017-02-14 20:01:48 UTC
Description of problem:


When running bootstrap.py with the --rex switches against a Capsule without the SSH feature, bootstrap fails with a traceback. 

Version-Release number of selected component (if applicable):
katello-client-bootstrap-1.2.2

How reproducible:
100%




Steps to Reproduce:

Run bootstrap with the --rex options against a capsule without the SSH feature

example: 

bootstrap.py -v -s capsule-1.example.com -o Example -a ak_Reg_To_Dev_EL7 --skip-foreman --enablerepos=rhel-7-server-satellite-tools-6.2-rpms --rex --rex-user=root --force


Actual results:
traceback similar to:

[NOTIFICATION], [2017-02-14 17:02:48], [The server was unable to fulfill the request. Error: 404] Traceback (most recent call last): File "./bootstrap.py", line 874, in install_foreman_ssh_key() File "./bootstrap.py", line 360, in install_foreman_ssh_key if foreman_ssh_key in open(foreman_ssh_authfile, 'r').read(): UnboundLocalError: local variable 'foreman_ssh_key' referenced before assignment

Expected results:

installing the remote execution key is an optional function of the bootstrap script. In the event that the key is unable to be downloaded, it should notify the user, but continue. 


Additional info:

Comment 3 Satellite Program 2017-02-23 21:11:53 UTC
Please add verifications steps for this bug to help QE verify

Comment 4 Rich Jerrido 2017-02-27 10:33:58 UTC
Verification Steps for QE:


Overview
========

As per the description of this BZ, bootstrap.py previously failed if the user provided the --rex & --rex-user options when run against a Capsule without the REX/SSH feature enabled. 

Setup
=====

* You must have an activation key to register the client
* You must have a Satellite Server. 
* You must have a Capsule without the REX/SSH feature enabled. 


Verification Steps
==================

* On the capsule, confirm that REX isn't installed

- hammer --output json capsule list

* on a client download the bootstrap.py script from the Satellite or Capsule and make executable

  wget http://satellite.example.com/pub/bootstrap.py
  chmod +x bootstrap.py

* on the client, run bootstrap to register the client via the capsule (that doesn't have REX enabled) with the --rex & --rex-user switch
n
./bootstrap.py -v -s capsule-1.example.com -o Example -a ak_Reg_To_Dev_EL7 --skip-foreman --enablerepos=rhel-7-server-satellite-tools-6.2-rpms --rex --rex-user=root

Expected behavior
=================

* bootstrap.py doesn't provide the traceback as listed in the description. 

* bootstrap.py informs the user that the REX keys could not be downloaded but continues with the other setup steps, similar to the following:

[NOTIFICATION], [2017-02-27 05:30:38], [The server was unable to fulfill the request. Error: 404 - Not Found] 
[NOTIFICATION], [2017-02-27 05:30:38], [Please ensure the Remote Execution feature is configured properly] 
[WARNING], [2017-02-27 05:30:38], NON-FATAL: [Installing Foreman SSH key] failed to execute properly

Comment 5 Rich Jerrido 2017-03-13 21:07:17 UTC
We may want to rebase to katello-client-bootstrap-1.3.0 (https://github.com/Katello/katello-client-bootstrap/releases/tag/1.3.0) to address this.

Comment 6 Sanket Jagtap 2017-04-04 06:07:51 UTC
Build: Satellite 6.2.9 snap2

[root@sjagtap-client ~]# ./bootstrap.py -s intel.asdas.com -o Default_Organization -a ak-rhel-7 --enablerepos=rhel-7-server-satellite-tools-6.2-rpms --skip-foreman --force --rex --rex-user=root

Log:

Complete!
[SUCCESS], [2017-04-03 11:58:15], [/usr/bin/yum -y install katello-agent], completed successfully.

[RUNNING], [2017-04-03 11:58:15], [/sbin/chkconfig goferd on]
Note: Forwarding request to 'systemctl enable goferd.service'.
[SUCCESS], [2017-04-03 11:58:15], [/sbin/chkconfig goferd on], completed successfully.

[RUNNING], [2017-04-03 11:58:15], [/sbin/service goferd restart]
Redirecting to /bin/systemctl restart  goferd.service
[SUCCESS], [2017-04-03 11:58:15], [/sbin/service goferd restart], completed successfully.

[NOTIFICATION], [2017-04-03 11:58:15], [Removing old RHN packages]
[RUNNING], [2017-04-03 11:58:15], [/usr/bin/yum -y remove rhn-setup rhn-client-tools yum-rhn-plugin rhnsd rhn-check rhnlib spacewalk-abrt spacewalk-oscap osad 'rh-*-rhui-client']
Loaded plugins: package_upload, product-id, search-disabled-repos, subscription-
              : manager
No Match for argument: rhn-setup
No Match for argument: rhn-client-tools
No Match for argument: yum-rhn-plugin
No Match for argument: rhnsd
No Match for argument: rhn-check
No Match for argument: rhnlib
No Match for argument: spacewalk-abrt
No Match for argument: spacewalk-oscap
No Match for argument: osad
No Match for argument: rh-*-rhui-client
No Packages marked for removal
[SUCCESS], [2017-04-03 11:58:19], [/usr/bin/yum -y remove rhn-setup rhn-client-tools yum-rhn-plugin rhnsd rhn-check rhnlib spacewalk-abrt spacewalk-oscap osad 'rh-*-rhui-client'], completed successfully.

[NOTIFICATION], [2017-04-03 11:58:19], [The server was unable to fulfill the request. Error: 404 - Not Found]
[NOTIFICATION], [2017-04-03 11:58:19], [Please ensure the Remote Execution feature is configured properly]
[WARNING], [2017-04-03 11:58:19], NON-FATAL: [Installing Foreman SSH key] failed to execute properly.

Comment 8 errata-xmlrpc 2017-05-01 14:00:01 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-2017:1191