Red Hat Bugzilla – Bug 842969
Inappropriate error is shown if add/update sshkey without key file path specified
Last modified: 2015-05-14 22:01:03 EDT
Description of problem:
Inappropriate error is shown if run "rhc sshkey add -i test" or "rhc sshkey update -i test" without key path specified.
Please refer to following error message:
# rhc sshkey add -i test
Generating ssh key pair for user 'test' in the dir '/root/.openshift/'
SSH key already exists: /root/.ssh/id_rsa. Reusing...
/usr/local/share/gems/gems/rhc-0.96.3/lib/rhc-common.rb:1146:in `initialize': can't convert nil into String (TypeError)
from /usr/local/share/gems/gems/rhc-0.96.3/lib/rhc-common.rb:1146:in `open'
from /usr/local/share/gems/gems/rhc-0.96.3/lib/rhc-common.rb:1146:in `add_or_update_key'
from /usr/local/share/gems/gems/rhc-0.96.3/bin/rhc-sshkey:162:in `<top (required)>'
from /usr/local/bin/rhc-sshkey:23:in `load'
from /usr/local/bin/rhc-sshkey:23:in `<main>'
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Run "rhc sshkey add -i keyname"
2. Run "rhc sshkey update -i keyname"
Error message is displayed.
Message prompt to tell user that keyfile path is required to add sshkey or generate a new pair of keys to upload.
We should add a cucumber test for this.
This issue happens because there is a /root/.ssh/id_rsa key but no /root/.ssh/id_rsa.pub key. We need to discuss what to do with this situation. We don't need to have a pub key file as we can generate it from the priv key. I suggest making this into a story as it is unlikely this situation would occure and we need to handle this everywhere so it isn't just a quick fix.
My opinion is it should go hand in hand with moving the sshkey command to the new Commander framework.
clayton to review by end of the day
Agree with J5's comment. Moving to story.
*** Bug 848303 has been marked as a duplicate of this bug. ***