Bug 1019562

Summary: [fork][origin_ui_112] Error message show up when add a krb5-principal type sshkey via rhc in ruby-1.8 env
Product: OpenShift Online Reporter: weiwei jiang <wjiang>
Component: ocAssignee: Jordan Liggitt <jliggitt>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: jliggitt, wjiang, wsun, xtian
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-24 03:24:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description weiwei jiang 2013-10-16 05:45:21 UTC
Description of problem:
when add a krb5-principal type sshkey, error message show up:
"An unexpected error occured: cannot encode Class: Commander::Command::Options"

But web console can add successfully


Version-Release number of selected component (if applicable):
fork_ami_origin_ui_112_907
rhc build from fork_ami_origin_ui_112_907 

How reproducible:
always

Steps to Reproduce:
1.Add a krb5-principal type sshkey 
2.check the output 
3.

Actual results:
# rhc sshkey add dfadf --type krb5-principal --content wjian --confirm --trace
/usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands/sshkey.rb:54: warning: Object#type is deprecated; use Object#class
/usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands/sshkey.rb:55: warning: Object#type is deprecated; use Object#class
Commander::Command::Options
wjian
/usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands/sshkey.rb:56: warning: Object#type is deprecated; use Object#class
The key you are uploading is not recognized.  You may not be able to authenticate to your application through Git or SSH.
/usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/vendor/okjson.rb:426:in `valenc': An unexpected error occured: cannot encode Class: Commander::Command::Options (RHC::Rest::ConnectionException)
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/vendor/okjson.rb:432:in `objenc'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/client.rb:510:in `map'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/vendor/okjson.rb:432:in `each'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/vendor/okjson.rb:432:in `map'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/vendor/okjson.rb:432:in `objenc'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/vendor/okjson.rb:418:in `valenc'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/json.rb:14:in `encode'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/core_ext.rb:21:in `to_json'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/client.rb:457:in `new_request'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/client.rb:272:in `request'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/client.rb:264:in `attempt'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/client.rb:263:in `each'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/client.rb:263:in `attempt'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/client.rb:270:in `request'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/base.rb:28:in `rest_method'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/user.rb:10:in `add_key'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/rest/client.rb:144:in `add_key'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands/sshkey.rb:79:in `add'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands.rb:285:in `send'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands.rb:285:in `execute'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands.rb:276: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:383:in `run_active_command'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/lib/rhc/command_runner.rb:102: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-1.16.0/lib/rhc/cli.rb:37:in `start'
	from /usr/lib/ruby/gems/1.8/gems/rhc-1.16.0/bin/rhc:20
	from /usr/bin/rhc:19:in `load'
	from /usr/bin/rhc:19


Expected results:
It should add successfully

Additional info:

Comment 1 Jordan Liggitt 2013-10-16 15:39:30 UTC
What version of ruby are you using?

Comment 2 Wei Sun 2013-10-17 04:55:08 UTC
Check this bug on fork_ami_origin_ui_112_907,rhc build from fork_ami_origin_ui_112_907.

Could reproduce this bug when ruby version is 1.8
rhc sshkey  add krb5t --type krb5-principal --content krb5testtest
/var/lib/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands/sshkey.rb:54: warning: Object#type is deprecated; use Object#class
/var/lib/gems/1.8/gems/rhc-1.16.0/lib/rhc/commands/sshkey.rb:55: warning: Object#type is deprecated; use Object#class
The provided type and content does not appear to be a recognizable key
(unsupported key type `�-��-'). You may specify the '--confirm' flag to add the
key anyway.

But could not reproduce this bug when ruby version is 1.9/2.0

[wsun@dhcp-8-229 ~]$ rhc sshkey  add krb5t --type krb5-principal --content krb5testtest
RESULT:
SSH key 'krb5t' has been added

Comment 3 Jordan Liggitt 2013-10-17 18:43:47 UTC
Fixed in fork_ami_origin_ui_112_915

Comment 4 Wei Sun 2013-10-18 03:06:30 UTC
Verify this bug on fork_ami_origin_ui_112_915 in ruby-1.8 env,rhc build from fork_ami_origin_ui_112_915.

Result:
openshift@openshift-ubuntu:~$ rhc sshkey add krb5y --type krb5-principal --content krb5test
Please sign in to start a new session to
ec2-107-22-103-112.compute-1.amazonaws.com.
Password: *
 
RESULT:
SSH key 'krb5y' has been added