Bug 857727 - Uploading GPG key on multiple Orgs leaves web ui in bad state
Uploading GPG key on multiple Orgs leaves web ui in bad state
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: WebUI (Show other bugs)
6.0.0
Unspecified Unspecified
unspecified Severity medium (vote)
: Unspecified
: --
Assigned To: Justin Sherrill
Og Maciel
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-16 11:30 EDT by Og Maciel
Modified: 2014-09-18 11:32 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Bad JavaScript code did not properly handle click events for GPG keys uploads to an organization. As a consequence, users were unable to repeatedly use the UI to upload multiple GPG keys. The fix corrects the JavaScript code to properly handle the upload. Users now safely upload multiple GPG keys to multiple organizations without issues.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-04 14:53:44 EST
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)
Screenshot (71.70 KB, image/png)
2012-09-16 11:30 EDT, Og Maciel
no flags Details
Tweaked gpg key (75.01 KB, image/png)
2012-09-16 11:50 EDT, Og Maciel
no flags Details

  None (edit)
Description Og Maciel 2012-09-16 11:30:14 EDT
Created attachment 613429 [details]
Screenshot

Description of problem:

I still need to figure out if the current constrain of uploading same gpg key file to multiple different organizations is valid, but if you do, the web interface gets in a pretty bad state (see screenshot). We should be able to render the error and not scramble the interface.

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


How reproducible:


Steps to Reproduce:
1. Import the same GPG key file to more than one (different) organization
2.
3.
  
Actual results:

The web interface gets into a pretty bad state (see screenshot) and the following error is displayed in the ui:

      ERROR: duplicate key value violates unique constraint "index_gpg_keys_on_organization_id_and_name" (PGError)
    Click here for more details.

Expected results:


Additional info:
Comment 1 Og Maciel 2012-09-16 11:31:00 EDT
Firebug shows the following error:

  TypeError: E is null
Comment 2 Og Maciel 2012-09-16 11:32:42 EDT
* candlepin-0.7.8-1.el6cf.noarch
* candlepin-selinux-0.7.8-1.el6cf.noarch
* candlepin-tomcat6-0.7.8-1.el6cf.noarch
* katello-1.1.12-7.el6cf.noarch
* katello-all-1.1.12-7.el6cf.noarch
* katello-candlepin-cert-key-pair-1.0-1.noarch
* katello-certs-tools-1.1.8-1.el6cf.noarch
* katello-cli-1.1.8-4.el6cf.noarch
* katello-cli-common-1.1.8-4.el6cf.noarch
* katello-common-1.1.12-7.el6cf.noarch
* katello-configure-1.1.9-3.el6cf.noarch
* katello-glue-candlepin-1.1.12-7.el6cf.noarch
* katello-glue-pulp-1.1.12-7.el6cf.noarch
* katello-qpid-broker-key-pair-1.0-1.noarch
* katello-qpid-client-key-pair-1.0-1.noarch
* katello-selinux-1.1.1-1.el6cf.noarch
* pulp-1.1.12-1.el6cf.noarch
* pulp-common-1.1.12-1.el6cf.noarch
* pulp-selinux-server-1.1.12-1.el6cf.noarch
Comment 4 Og Maciel 2012-09-16 11:44:17 EDT
FWIW, the GPG keys seems to get added in the end.
Comment 5 Og Maciel 2012-09-16 11:50:30 EDT
Created attachment 613431 [details]
Tweaked gpg key

Took the same GPG key and edited it so to change the contents of its content by replacing random characters, and upload it. The web ui now displayed the content of the traceback.

Firebug shows:

  TypeError: b is undefined  	

...},edit_gpg_key_path:function(c,b){return a.build_path(2,["/gpg_keys/","/edit"],a...(common...7631838 (line 77)

production.log:


Started POST "/cfse/gpg_keys" for 10.11.9.160 at Sun Sep 16 11:20:46 -0400 2012
[ INFO: 2012-09-16 11:20:46 #18111]   Processing by GpgKeysController#create as HTML
[ INFO: 2012-09-16 11:20:46 #18111]   Parameters: {"authenticity_token"=>"B+GXw8sISmBR4fMS4HU/kZMUk4zuxvOGaJ5zxOfKJGg=", "utf8"=>"✓", "gpg_key"=>{"name"=>"Beans", "content_upload"=>#<ActionDispatch::Http::UploadedFile:0x7fd2460ff490 @tempfile=#<File:/tmp/RackMultipart20120916-18111-1ane0if-0>, @headers="Content-Disposition: form-data; name=\"gpg_key[content_upload]\"; filename=\"dummy2.gpg\"\r\nContent-Type: application/octet-stream\r\n", @content_type="application/octet-stream", @original_filename="dummy2.gpg">}}
[DEBUG: 2012-09-16 11:20:46 #18111] Setting locale: en
[DEBUG: 2012-09-16 11:20:46 #18111] Setting current user thread-local variable to admin
[DEBUG: 2012-09-16 11:20:46 #18111] Checking  params  for gpg_keys/create
[DEBUG: 2012-09-16 11:20:46 #18111] Authorizing admin for gpg_keys/create
[DEBUG: 2012-09-16 11:20:46 #18111] Setting current user thread-local variable to nil
[ INFO: 2012-09-16 11:20:47 #18107] Rendered common/_list_item.html.haml (1.0ms)
[DEBUG: 2012-09-16 11:20:47 #18107] Setting current user thread-local variable to nil
[ INFO: 2012-09-16 11:20:47 #18107] Completed 200 OK in 175ms (Views: 2.1ms | ActiveRecord: 55.3ms)
[ INFO: 2012-09-16 11:20:47 #18111] Rendered text template within layouts/katello (11.6ms)
[ INFO: 2012-09-16 11:20:47 #18111] Completed 500 Internal Server Error in 124ms
[ INFO: 2012-09-16 11:20:47 #18107] 

Started GET "/cfse/gpg_keys/4/edit" for 10.11.9.160 at Sun Sep 16 11:20:47 -0400 2012
[ INFO: 2012-09-16 11:20:47 #18107]   Processing by GpgKeysController#edit as HTML
[ INFO: 2012-09-16 11:20:47 #18107]   Parameters: {"id"=>"4"}
[DEBUG: 2012-09-16 11:20:47 #18107] Setting locale: en
[DEBUG: 2012-09-16 11:20:47 #18107] Setting current user thread-local variable to admin
[DEBUG: 2012-09-16 11:20:47 #18107] Checking  params  for gpg_keys/edit
[DEBUG: 2012-09-16 11:20:47 #18107] Authorizing admin for gpg_keys/edit
[ INFO: 2012-09-16 11:20:47 #18107] Rendered common/_helptip_button.html.haml (2.6ms)
[ INFO: 2012-09-16 11:20:47 #18107] Rendered common/_helptip.html.haml (1.7ms)
[ INFO: 2012-09-16 11:20:47 #18107] Rendered gpg_keys/_edit.html.haml (17.6ms)
[DEBUG: 2012-09-16 11:20:47 #18107] Setting current user thread-local variable to nil
[ INFO: 2012-09-16 11:20:47 #18107] Completed 200 OK in 44ms (Views: 19.0ms | ActiveRecord: 7.1ms)
[FATAL: 2012-09-16 11:20:47 #18111] 
ActionView::Template::Error (current user is not set):
    21:       = yield
    22:   - else
    23:     %nav.subnav#subnav
    24:       = render_main_sub_menu
    25:     .inner.container_16
    26:       = yield
    27: 
  app/models/user.rb:283:in `allowed_to?'
  app/models/activation_key.rb:207:in `readable?'
  lib/navigation/content_management.rb:70:in `menu_activation_keys'
  app/helpers/menu.rb:70:in `call'
  app/helpers/menu.rb:70:in `prune_menu'
  app/helpers/menu.rb:67:in `delete_if'
  app/helpers/menu.rb:67:in `prune_menu'
  app/helpers/menu.rb:76:in `prune_menu'
  app/helpers/menu.rb:67:in `delete_if'
  app/helpers/menu.rb:67:in `prune_menu'
  app/helpers/menu.rb:76:in `prune_menu'
  app/helpers/menu.rb:67:in `delete_if'
  app/helpers/menu.rb:67:in `prune_menu'
  app/helpers/menu.rb:54:in `render_sublevel_menu'
  app/helpers/menu.rb:49:in `render_main_sub_menu'
  app/views/layouts/katello.haml:24:in `_app_views_layouts_katello_haml___1656971611_70270550037980_0'
  app/views/layouts/katello.haml:18:in `_app_views_layouts_katello_haml___1656971611_70270550037980_0'
  app/controllers/application_controller.rb:63:in `__bind_1347808846_946417'
  app/controllers/application_controller.rb:62:in `__bind_1347808846_946417'

[ INFO: 2012-09-16 11:20:48 #18111] Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.6ms)
[ INFO: 2012-09-16 11:20:48 #18111] Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (22.3ms)
[ INFO: 2012-09-16 11:20:48 #18111] Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (60.3ms)
[ INFO: 2012-09-16 11:20:48 #18111]
Comment 6 Justin Sherrill 2012-09-17 12:19:49 EDT
Should be fixed with PR https://github.com/Katello/katello/pull/682
Comment 7 Justin Sherrill 2012-09-17 12:21:36 EDT
a1e2f99adc8294a0bdb07ea45c9132361a36dcf1
Comment 10 Og Maciel 2012-09-25 17:57:27 EDT
Verified using:

* candlepin-0.7.8-1.el6cf.noarch
* candlepin-selinux-0.7.8-1.el6cf.noarch
* candlepin-tomcat6-0.7.8-1.el6cf.noarch
* katello-1.1.12-9.el6cf.noarch
* katello-all-1.1.12-9.el6cf.noarch
* katello-candlepin-cert-key-pair-1.0-1.noarch
* katello-certs-tools-1.1.8-1.el6cf.noarch
* katello-cli-1.1.8-5.el6cf.noarch
* katello-cli-common-1.1.8-5.el6cf.noarch
* katello-common-1.1.12-9.el6cf.noarch
* katello-configure-1.1.9-4.el6cf.noarch
* katello-glue-candlepin-1.1.12-9.el6cf.noarch
* katello-glue-pulp-1.1.12-9.el6cf.noarch
* katello-qpid-broker-key-pair-1.0-1.noarch
* katello-qpid-client-key-pair-1.0-1.noarch
* katello-selinux-1.1.1-1.el6cf.noarch
* pulp-1.1.12-1.el6cf.noarch
* pulp-common-1.1.12-1.el6cf.noarch
* pulp-selinux-server-1.1.12-1.el6cf.noarch
Comment 12 errata-xmlrpc 2012-12-04 14:53:44 EST
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

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