Red Hat Bugzilla – Bug 1422236
Bootstrap fails with traceback if it cannot find the Foreman SSH Key
Last modified: 2017-05-01 10:00:01 EDT
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:
Fixed upstream in commit https://github.com/Katello/katello-client-bootstrap/commit/d7c4886e8af105043ad3125dfa95320beacae231
Please add verifications steps for this bug to help QE verify
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
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.
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.
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