Bug 1044930

Summary: Error message is mess when adding invalid sshkey file without using --confirm option.
Product: OpenShift Online Reporter: Yujie Zhang <yujzhang>
Component: ocAssignee: Jordan Liggitt <jliggitt>
Status: CLOSED WONTFIX QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 2.xCC: dmcphers, jliggitt, 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: 2015-06-11 21:54:38 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:

Description Yujie Zhang 2013-12-19 09:13:05 UTC
Description of problem:

Tried to add sshkey file with empty content, got the following result:
[root@dhcp-8-252 home]# rhc sshkey add dddd ~/.ssh/empty.pub
File '/root/.ssh/empty.pub' does not appear to be a recognizable key file (public key at  is not
valid). You may specify the '--confirm' flag to add the key anyway.

**There should be a key path after the "(public key at".

Tried to add sshkey file with "ssh-rsa aasd" content:
[root@dhcp-8-252 home]# rhc sshkey add dddd ~/.ssh/empty.pub
File '/root/.ssh/empty.pub' does not appear to be a recognizable key file (not a public key ""). You
may specify the '--confirm' flag to add the key anyway.

**There should be key content in the "".

Tried to add sshkey file with "ssh-rsa LLLLLLLLLLLLLLOKJOIGUSOPIDFUSDFLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLSKJFOSKDFJSIDFLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLSLKDFLKSJDLKSLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
" content:

[root@dhcp-8-252 home]# rhc sshkey add dddd ~/.ssh/empty.pub
File '/root/.ssh/empty.pub' does not appear to be a recognizable key file (unsupported key type
`��,��,��$�Q#1TH1K,��,��,��,��,��,��,��-"���
                                              RR 1K,��,��,��,��,��,��,��,��,��,��,��,��,��
��,��,��,��,��,��,��,��,��,��,��,��,��,��,��'). You may specify the '--confirm' flag to add the key
anyway.

The message is really mess.

Version-Release number of selected component (if applicable):
devenv_4156
rhc-1.19.2

How reproducible:
always

Steps to Reproduce:
1.Create an empty.pub with empty content
2.Run command 'rhc sshkey add dddd ~/.ssh/empty.pub'
3.Edit the empty.pub with "ssh-rsa aasd" content
4.Run command 'rhc sshkey add dddd ~/.ssh/empty.pub'
5.Edit the empty.pub with "ssh-rsa LLLLLLLLLLLLLLOKJOIGUSOPIDFUSDFLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLSKJFOSKDFJSIDFLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLSLKDFLKSJDLKSLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
" content
6.Run command 'rhc sshkey add dddd ~/.ssh/empty.pub'


Actual results:

2.[root@dhcp-8-252 home]# rhc sshkey add dddd ~/.ssh/empty.pub
File '/root/.ssh/empty.pub' does not appear to be a recognizable key file (public key at  is not
valid). You may specify the '--confirm' flag to add the key anyway.
4.[root@dhcp-8-252 home]# rhc sshkey add dddd ~/.ssh/empty.pub
File '/root/.ssh/empty.pub' does not appear to be a recognizable key file (not a public key ""). You
may specify the '--confirm' flag to add the key anyway.
6.
[root@dhcp-8-252 home]# rhc sshkey add dddd ~/.ssh/empty.pub
File '/root/.ssh/empty.pub' does not appear to be a recognizable key file (unsupported key type
`��,��,��$�Q#1TH1K,��,��,��,��,��,��,��-"���
                                              RR 1K,��,��,��,��,��,��,��,��,��,��,��,��,��
��,��,��,��,��,��,��,��,��,��,��,��,��,��,��'). You may specify the '--confirm' flag to add the key
anyway.

Expected results:

The warning message should be in correct format and should not miss content.

Additional info: