Bug 1218872 - rhc setup fail during upload sshkey
Summary: rhc setup fail during upload sshkey
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Node
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: ---
Assignee: Vu Dinh
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-06 06:13 UTC by Anping Li
Modified: 2015-12-17 17:10 UTC (History)
9 users (show)

Fixed In Version: rubygem-openshift-origin-controller-1.38.4.1-1.el6op
Doc Type: Bug Fix
Doc Text:
If the MINIMUM_SSH_KEY_SIZE parameter was not set in the /etc/openshift/broker.conf file, a nil value was passed into a condition statement which failed due to lack of nil checking. This caused the `rhc` command to fail to upload the SSH key while creating a new domain. This bug fix updates the condition statement to handle a nil value and return the correct DEFAULT_MINIMUM_SSH_KEY_SIZE value. As a result, the `rhc` command can now successfully upload the SSH key in this scenario.
Clone Of:
Environment:
Last Closed: 2015-12-17 17:10:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Production log for this issue (15.24 KB, text/plain)
2015-05-06 06:16 UTC, Anping Li
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2666 0 normal SHIPPED_LIVE Important: Red Hat OpenShift Enterprise 2.2.8 security, bug fix, and enhancement update 2015-12-17 22:07:54 UTC

Description Anping Li 2015-05-06 06:13:30 UTC
Description of problem:

rhc setup failed  during upload sshkey. the following message are reported "
Unable to complete the requested operation due to: undefined method `[]' for nil:NilClass
Reference ID: a3e0683fa1c98799089d55c3ad24193d"

Version-Release number of selected component (if applicable):
OSE 2.2-2015-05-05.1

How reproducible:

Always
Steps to Reproduce:
1. install a fresh openshift with latest puddle 
2. install the miss rpm "ruby193-rubygem-net-ssh" on broker ( Bug 1218841 had been filed for the missing package)
3. rhc setup

Actual results:
Step 3 failed with following error, the error log are attached.
Your public SSH key must be uploaded to the OpenShift server to access code.  Upload now? (yes|no) yes
Since you do not have any keys associated with your OpenShift account, your new key will be uploaded as the 'default' key.
Unable to complete the requested operation due to: undefined method `[]' for nil:NilClass
Reference ID: a3e0683fa1c98799089d55c3ad24193d


Expected results:
rhc setup succeed.


Additional info:

Comment 2 Anping Li 2015-05-06 06:16:09 UTC
Created attachment 1022483 [details]
Production log for this issue

Comment 6 Anping Li 2015-05-07 02:19:35 UTC
rhc setup works, user domain can be created.Verified and pass in puddle-2-2-2015-05-06

Comment 7 Miciah Dashiel Butler Masters 2015-09-22 15:50:05 UTC
If I understand comment 4 correctly, the problem appears if Rails.application.config.openshift[:minimum_ssh_key_size] is nil, which was happening because production.rb was not initialising it with the value from the MINIMUM_SSH_KEY_SIZE setting in broker.conf.

The defect is fixed, and never shipped, in the sense that production.rb correctly initialises Rails.application.config.openshift[:minimum_ssh_key_size] with the value of MINIMUM_SSH_KEY_SIZE.  For this reason, I am inclined to mark this Bugzilla report CLOSED CURRENTRELEASE.

However, I believe we will see the same error if MINIMUM_SSH_KEY_SIZE is not set in broker.conf.  We should change the || to a rescue, or check that Rails.application.config.openshift[:minimum_ssh_key_size] is not nil before trying to read Rails.application.config.openshift[:minimum_ssh_key_size][ssh_key_type].  I would like to change this code to use rescue so that it will work properly even if MINIMUM_SSH_KEY_SIZE is not set.

Tim, does that make sense? If so, I can take this issue and fix it as I described for the next release.

Comment 8 Timothy Williams 2015-10-20 14:13:45 UTC
Miciah,

That absolutely makes sense. We should have a rescue there instead so we don't treat nil like an array.

Feel free to take this issue, and thanks!

Comment 9 Vu Dinh 2015-10-30 22:02:27 UTC
PR <https://github.com/openshift/origin-server/pull/6299> is submitted to fix this bug.

Comment 10 openshift-github-bot 2015-11-02 22:24:08 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/facd441df157c78baf89cfbb646378043599c914
Bug 1218872: Fix rhc setup fail during upload sshkey

Uploading ssh key during 'rhc setup' command may fail due to the method
'get_minimum_ssh_key_size' returns nil if MINIMUM_SSH_KEY_SIZE variable
is not set in broker.conf file.

This commit change the '||' operation to use rescue instead in order to
handle the nil case from the first condition and return the default value
'DEFAULT_MINIMUM_SSH_KEY_SIZE' which is zero by default in case nil value
detected.

Bug 1218872
Link <https://bugzilla.redhat.com/show_bug.cgi?id=1218872>

Signed-off-by: Vu Dinh <vdinh>

Comment 13 Johnny Liu 2015-11-13 06:55:26 UTC
Verified this bug with OpenShiftEnterpriseErrata/2.2/2015-11-11.1, and PASS.


# grep MIN /etc/openshift/broker.conf 
# e.g.: MINIMUM_SSH_KEY_SIZE="ssh-rsa|2048 ssh-dss|1024"
#MINIMUM_SSH_KEY_SIZE=


Run "rhc setup" successfully, ssh-key is uploaded successfully.

Comment 15 errata-xmlrpc 2015-12-17 17:10:03 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://rhn.redhat.com/errata/RHSA-2015-2666.html


Note You need to log in before you can comment on or make changes to this bug.