Bug 854433 - Inappropriate error is shown when adding an sshkey with non-existing key file path
Inappropriate error is shown when adding an sshkey with non-existing key file...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Hiro Asari
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-04 23:32 EDT by Jianwei Hou
Modified: 2015-05-14 22:04 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-09-17 17:30:11 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jianwei Hou 2012-09-04 23:32:58 EDT
Description of problem:
Add an sshkey with non-existing key file path, the command is broken and returns inappropriate messages.

Version-Release number of selected component (if applicable):
fork_ami_US2600_71

How reproducible:
Always

Steps to Reproduce:
1. Add an sshkey and specify a non-existing key file
   rhc sshkey add newkey ~/.ssh/newkey.pub  (the ~/.ssh/abc.pub does not exist)
  
Actual results:
Command failed

[root@ip-10-111-7-229 .ssh]# rhc sshkey add newkey ~/.ssh/newkey.pub
/usr/lib/ruby/gems/1.8/gems/rhc-0.98.7/lib/rhc/commands/sshkey.rb:38:in `initialize': No such file or directory - /root/.ssh/newkey.pub (Errno::ENOENT)
	from /usr/lib/ruby/gems/1.8/gems/rhc-0.98.7/lib/rhc/commands/sshkey.rb:38:in `open'
	from /usr/lib/ruby/gems/1.8/gems/rhc-0.98.7/lib/rhc/commands/sshkey.rb:38:in `add'
	from /usr/lib/ruby/gems/1.8/gems/rhc-0.98.7/lib/rhc/commands.rb:72:in `send'
	from /usr/lib/ruby/gems/1.8/gems/rhc-0.98.7/lib/rhc/commands.rb:72:in `to_commander'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/command.rb:155:in `run'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/runner.rb:385:in `run_active_command'
	from /usr/lib/ruby/gems/1.8/gems/rhc-0.98.7/lib/rhc/command_runner.rb:30:in `run!'
	from /usr/lib/ruby/gems/1.8/gems/commander-4.0.3/lib/commander/delegates.rb:7:in `run!'
	from /usr/lib/ruby/gems/1.8/gems/rhc-0.98.7/lib/rhc/cli.rb:36:in `start'
	from /usr/lib/ruby/gems/1.8/gems/rhc-0.98.7/bin/rhc:65
	from /usr/bin/rhc:19:in `load'
	from /usr/bin/rhc:19


Expected results:
Should return messages indicating specified key file does not exist

Additional info:
Comment 1 Hiro Asari 2012-09-05 09:44:42 EDT
The message indicates this, though.

No such file or directory - /root/.ssh/newkey.pub (Errno::ENOENT)

Are you saying that the command should hide the backtrace?
Comment 2 Hiro Asari 2012-09-05 10:18:49 EDT
The fix is quite easy, of course, but I will consult others before committing to a fix for this.
Comment 3 jizhao 2012-09-06 07:40:35 EDT
This bug is verified on fork_ami_US2600_76.

Steps to verify:
1.Add an non-existing pub key:
$ rhc sshkey add newkey ~/.ssh/newkey.pub


Results:
1. File '/root/.ssh/newkey.pub' does not exist.

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