Bug 859329

Summary: [CFSE GUI] Unexpected code is displayed in the error message when uploading an empty file or no gpg file to GPG Key.
Product: Red Hat Satellite Reporter: Lijun Li <lijli>
Component: WebUIAssignee: David Davis <daviddavis>
Status: CLOSED ERRATA QA Contact: Sachin Ghai <sghai>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.1CC: asettle, cpelland, dmacpher, mmccune, omaciel, qe-i18n-bugs
Target Milestone: UnspecifiedKeywords: Reopened, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
uploading an empty file or no GPG file to GPG Key produces unexpected code in the error message. This raised an error ("Content can't be blank") without throwing any UI exception. This fix corrects the error message, which displays without unexpected code.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-04 19:56:08 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:
Attachments:
Description Flags
Unexpected code is displayed in the error message when uploading an empty file or no gpg file to GPG Key
none
importing a blank gpg key file raised 'Content can't be blank' none

Description Lijun Li 2012-09-21 07:24:49 UTC
Description of problem:
Unexpected code is displayed in the error message when uploading an empty file or no gpg file to GPG Key

Version-Release number of selected component (if applicable):
katello-1.1.12-7.el6cf.noarch
katello-cli-1.1.8-4.el6cf.noarch

How reproducible:
100%

Steps to Reproduce:
1. Install latest CloudForms System Engine build.
2. Log in CFSE.
3. Click the Content->Repositories->GPG Keys application subtab
4. Click New GPG Key, type name and click Browse to upload an empty file or no gpg file.
5. Click Upload.

  
Actual results:
Unexpected code is displayed in the error message when uploading an empty file or no gpg file to GPG Key

Expected results:
Should have an error message without the unexpected code page to say cannot upload empty file or no gpg file to GPG Keys.

Additional info:

Comment 1 Lijun Li 2012-09-21 07:26:10 UTC
Errors::UserNotSet in Gpg_keys#create

Showing /usr/share/katello/app/views/layouts/katello.haml where line #24 raised:

current user is not set

Extracted source (around line #24):

21:       = yield
22:   - else
23:     %nav.subnav#subnav
24:       = render_main_sub_menu
25:     .inner.container_16
26:       = yield
27: 

Rails.root: /usr/share/katello

Also please refer to the attached screenshot.

Comment 2 Lijun Li 2012-09-21 07:26:54 UTC
Created attachment 615295 [details]
Unexpected code is displayed in the error message when uploading an empty file or no gpg file to GPG Key

Comment 3 Lijun Li 2012-09-21 07:29:20 UTC
OR Steps to Reproduce:
1. Install latest CloudForms System Engine build.
2. Log in CFSE.
3. Click the Content->Repositories->GPG Keys application subtab
4. Click New GPG Key, click Upload button directly.

Comment 5 David Davis 2012-10-04 15:45:58 UTC
Hmm. I get the following when I click Upload with no gpg key or a blank file:

Validation Failed:
Name can't be blank
Name must contain at least 2 characters
Content can't be blank

It could either be:

1. This has since been fixed.
2. This may be only happening in certain browsers.

Can you retest and if it's still happening, let me know what browser you're using? 

Thank you!

Comment 9 David Davis 2012-10-05 17:34:37 UTC
So it looks like the original error is related to #829437 as the stacktrace is the same.

I'll take a look into uploading an empty file though.

Comment 10 David Davis 2012-10-05 17:59:40 UTC
I can't reproduce on the SE 1.1 branch. I'm trying Puddle #1 next.

Comment 12 David Davis 2012-10-08 12:29:19 UTC
Oh, I was able to reproduce uploading a non-gpgkey file and have not had a problem doing that or received any validation regarding that.

Comment 13 David Davis 2012-10-08 12:30:37 UTC
Tried with existing gpg keys--still received expected error validation message.

Comment 15 Og Maciel 2012-10-09 21:33:34 UTC
Should have provided better steps to reproduce this, my bad.

* Import a non-GPG key file (could be a text file
  * You should now see the contents from that text file displayed
* Create an empty file:  touch /tmp/foo
* From the Details tab, now try to import /tmp/foo

You should see the web ui all mangled and a javascript (assuming you're running firebug or equivalent)

Comment 16 David Davis 2012-10-09 21:36:16 UTC
Og, your steps were clear. I went through your steps and wasn't able to reproduce though. I didn't get a mangled UI or a javascript error. I'll reopen though and I'll try taking a look again tomorrow.

Comment 17 Mike McCune 2012-10-09 21:40:45 UTC
re-opening since I can reproduce reliably.

as Og mentions above the error condition only occurs if you re-upload a blank key file to an *existing* GPG key.

It detects the blank condition on the 1st upload but the 2nd upload will fail with the strange error

Comment 18 Mike McCune 2012-10-09 21:43:22 UTC
another screenshot that I got after re-uploading a blank file to an already existing GPG key:

http://mmccune.fedorapeople.org/scratch/busted-gpg.png

Comment 19 David Davis 2012-10-09 22:06:28 UTC
how exactly do you re-open an open bug?

Comment 20 Og Maciel 2012-10-09 22:10:51 UTC
It is already ASSIGNED so you're good to go :)

Comment 21 David Davis 2012-10-09 22:37:13 UTC
Opened pull request although I'm having an issue with notify.js:

https://github.com/Katello/katello/pull/823

Comment 22 David Davis 2012-10-10 16:05:17 UTC
Katello commits:

4c5cc6635713e64fde0f552ff91e781690bc1afa
27f2807cd650edf23ea2b3f53f9acebc2ee4fafd

Test fixes:

eff04a8b2fac2858269dd9a5399155ef5f3dfa7c
c8cb4df1958a24b75dc52f418ce4854ec44ff102

Comment 25 Sachin Ghai 2012-10-17 13:43:25 UTC
Verified this defect with following CFSE build:

katello-configure-1.1.9-7.el6cf.noarch
katello-common-1.1.12-16.el6cf.noarch
katello-1.1.12-16.el6cf.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-cli-1.1.8-7.el6cf.noarch
katello-certs-tools-1.1.8-1.el6cf.noarch
katello-glue-candlepin-1.1.12-16.el6cf.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
katello-cli-common-1.1.8-7.el6cf.noarch
katello-glue-pulp-1.1.12-16.el6cf.noarch
katello-qpid-client-key-pair-1.0-1.noarch
katello-selinux-1.1.1-1.el6cf.noarch
katello-all-1.1.12-16.el6cf.noarch


Re-importing a blank gpg-key file, when one gpgkey is already imported in UI, raised an error "Content can't be blank" without throwing any UI exception. Please see the attachment in next comment.

However UI successfully imports any dummy text file with some random text so I'll log a separate defect for this.

Comment 26 Sachin Ghai 2012-10-17 13:44:54 UTC
Created attachment 628825 [details]
importing a blank gpg key file raised 'Content can't be blank'

Comment 27 Sachin Ghai 2012-11-06 14:42:53 UTC
verified as per comment25.

Comment 29 errata-xmlrpc 2012-12-04 19:56:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-1543.html

Comment 30 Mike McCune 2013-08-16 17:59:53 UTC
getting rid of 6.0.0 version since that doesn't exist