Bug 854433 - Inappropriate error is shown when adding an sshkey with non-existing key file path
Summary: Inappropriate error is shown when adding an sshkey with non-existing key file...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: oc
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Hiro Asari
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-05 03:32 UTC by Jianwei Hou
Modified: 2015-05-15 02:04 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-09-17 21:30:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jianwei Hou 2012-09-05 03:32:58 UTC
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 13:44:42 UTC
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 14:18:49 UTC
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 11:40:35 UTC
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.