Bug 751033
| Summary: | adding subscriptions to activation key - exception thrown | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Garik Khachikyan <gkhachik> | ||||
| Component: | katello-agent | Assignee: | Lukas Zapletal <lzap> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Katello QA List <katello-qa-list> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 6.0.0 | CC: | bkearney, kbidarka, lzap, mkoci | ||||
| Target Milestone: | Unspecified | Keywords: | Reopened, Triaged | ||||
| Target Release: | Unused | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2012-08-22 18:04:20 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 747354 | ||||||
| Attachments: |
|
||||||
|
Description
Garik Khachikyan
2011-11-03 10:04:46 UTC
Taking I am not able to reproduce with current master. Subscription is added there:
katello> activation_key info --name ak1 --org org1
--------------------------------------------------------------------------------
Activation Key Info
--------------------------------------------------------------------------------
Id: 1
Name: ak1
Description:
None
Environment Id: 3
System Template Id: None
Pools:
[ ff80808133690ec201336913a9e30006 ]
Here is a log of the call which failed for you.
Started POST "/api/activation_keys/1/pools" for 127.0.0.1 at Thu Nov 03 11:59:33 +0100 2011
Processing by Api::ActivationKeysController#add_pool as JSON
Parameters: {"poolid"=>"ff80808133690ec201336913a9e30006", "id"=>"1"}
Setting locale: en
Warden is authenticating admin against database
Setting current user thread-local variable to admin
Resource GET request: /candlepin/pools/ff80808133690ec201336913a9e30006
Headers: {"accept":"application/json","content-type":"application/json","cp-user":"admin"}
Body: {}
Processing response: 200
{"id":"ff80808133690ec201336913a9e30006","attributes":[],"owner":{"href":"/owners/org1","id":"ff80808133690ec20133691385ba0003","key":"org1","displayName":"org1"},"providedProducts":[],"startDate":"2011-11-03T00:00:00.000+0000","endDate":"2041-10-26T00:00:00.000+0000","productName":"product1","quantity":-1,"contractNumber":"","accountNumber":"","productId":"1320317855903","subscriptionId":"ff80808133690ec201336913a8fb0005","consumed":0,"sourceEntitlement":null,"href":"/pools/ff80808133690ec201336913a9e30006","activeSubscription":true,"restrictedToUsername":null,"productAttributes":[],"updated":"2011-11-03T10:57:36.227+0000","created":"2011-11-03T10:57:36.227+0000"}
Authorizing admin for api/activation_keys/add_pool
Setting current user thread-local variable to nil
Completed 200 OK in 929ms (Views: 6.7ms | ActiveRecord: 68.1ms)
WFM, please provide full log or reproducer box and reopen then.
Working gh -- 8c20cbb6d679d1eb93b2800609f03cfe4440d944 # REOPEN I have to reopen the issue (as it still fails for me): logs would be attached below. Packages the checks were performed: candlepin-0.4.25-1.el6.noarch pulp-0.0.237-5.el6.noarch katello-0.1.98-1.git.13.5a8e341.el6.x86_64 katello-cli-0.1.10-1.git.1114.377e093.el6.noarch Created attachment 531742 [details]
Katello production.log
Katello is built right from git master.
checked the scenario in comment#0 - the same still exists on recent/latest katello. Version: katello-0.1.99-1.git.89.bc81fa8.el6.x86_64 After three hours of debugging I found ApiController.require_user method is not getting called. After more debugging it is working again without any change. Very strange. So my next finding is - it works without any problem when in development mode, in the production mode I see the same error. Cool... More details:
katello> activation_key update --org org1 --name ak1 --add_subscription ff808081349e3e6501349e4d9f15000b
unauthenticated to call a backend engine
I have added
logger.info "REQUIRE USER"
to the ApiController.require_user method. As we can see it is NOT called for the last POST:
Started GET "/katello///api/organizations/org1" for 127.0.0.1 at Mon Jan 02 13:25:50 +0100 2012
Processing by Api::OrganizationsController#show as JSON
Parameters: {"id"=>"org1"}
REQUIRE USER
Completed 200 OK in 230ms (Views: 4.7ms | ActiveRecord: 11.0ms)
Started GET "/katello///api/organizations/org1/activation_keys/?name=ak1" for 127.0.0.1 at Mon Jan 02 13:25:50 +0100 2012
Processing by Api::ActivationKeysController#index as JSON
Parameters: {"name"=>"ak1", "organization_id"=>"org1"}
REQUIRE USER
Completed 200 OK in 44ms (Views: 21.6ms | ActiveRecord: 8.8ms)
Started PUT "/katello///api/activation_keys/1/" for 127.0.0.1 at Mon Jan 02 13:25:50 +0100 2012
Processing by Api::ActivationKeysController#update as JSON
Parameters: {"activation_key"=>{}, "id"=>"1"}
REQUIRE USER
Completed 200 OK in 47ms (Views: 3.5ms | ActiveRecord: 8.6ms)
Started POST "/katello///api/activation_keys/1/pools" for 127.0.0.1 at Mon Jan 02 13:25:51 +0100 2012
Processing by Api::ActivationKeysController#add_pool as JSON
Parameters: {"poolid"=>"ff808081349e3e6501349e4d9f15000b", "id"=>"1"}
Errors::UserNotSet: unauthenticated to call a backend engine
/usr/share/katello/app/models/user.rb:332:in `cp_oauth_header'
/usr/share/katello/lib/resources/candlepin.rb:62:in `default_headers'
/usr/share/katello/lib/resources/candlepin.rb:295:in `get'
/usr/share/katello/app/models/glue/candlepin/pool.rb:25:in `included'
/usr/share/katello/app/models/lazy_accessor.rb:134:in `instance_eval'
/usr/share/katello/app/models/lazy_accessor.rb:134:in `run_initializer'
/usr/share/katello/app/models/lazy_accessor.rb:75:in `owner'
/usr/share/katello/app/models/glue/candlepin/pool.rb:74:in `organization'
/usr/share/katello/app/models/glue/candlepin/pool.rb:40:in `find_by_organization_and_id'
/usr/share/katello/app/controllers/api/activation_keys_controller.rb:103:in `find_pool'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:437:in `_run__1939669248__process_action__508642999__callbacks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:410:in `send'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:94:in `send'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:94:in `run_callbacks'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/callbacks.rb:17:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/rescue.rb:17:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `instrument'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `instrument'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/base.rb:119:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/rendering.rb:41:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal.rb:138:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal.rb:178:in `action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:62:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:27:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/route_set.rb:150:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:93:in `recognize'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:82:in `optimized_each'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:92:in `recognize'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/route_set.rb:141:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:493:in `call'
/usr/lib/ruby/gems/1.8/gems/warden-1.0.3/lib/warden/manager.rb:35:in `call'
/usr/lib/ruby/gems/1.8/gems/warden-1.0.3/lib/warden/manager.rb:34:in `catch'
/usr/lib/ruby/gems/1.8/gems/warden-1.0.3/lib/warden/manager.rb:34:in `call'
/usr/lib/ruby/gems/1.8/gems/sass-3.1.7/lib/sass/../sass/plugin/rack.rb:54:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/head.rb:14:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/methodoverride.rb:24:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/flash.rb:182:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/cookies.rb:302:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:32:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:12:in `cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:31:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/callbacks.rb:46:in `call'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/sendfile.rb:102:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/rack/logger.rb:13:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/runtime.rb:17:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/lock.rb:34:in `call'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:168:in `call'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:77:in `send'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:77:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/urlmap.rb:52:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/urlmap.rb:46:in `each'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/urlmap.rb:46:in `call'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:84:in `pre_process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:82:in `catch'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:82:in `pre_process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:57:in `process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:42:in `receive_data'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/backends/base.rb:61:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/server.rb:159:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/controllers/controller.rb:86:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `send'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `run_command'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:151:in `run!'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/bin/thin:6
/usr/bin/thin:19:in `load'
/usr/bin/thin:19
Completed 403 Forbidden in 9ms (Views: 0.6ms | ActiveRecord: 2.3ms)
commit f42b46315ace7b96551ec20fd640824dfedb78d6 Refs: <origin/HEAD>, <origin/master>, katello-0.1.156-1-2-gf42b463 Author: Lukas Zapletal <lzap+git> AuthorDate: Mon Jan 2 14:08:23 2012 +0100 Commit: Lukas Zapletal <lzap+git> CommitDate: Mon Jan 2 14:08:23 2012 +0100 [root@szasxd pulp]# katello --username admin --password admin activation_key update --add_subscription 8ac149d334a786380134abbfa6a70096 --org ACME_Corporation --name 12345007
Successfully updated activation key [ 12345007 ]
[root@sxazsd pulp]# katello --username admin --password admin activation_key list --org ACME_Corporation
--------------------------------------------------------------------------------
Activation Key List
Id Name Description Environment Id System Template Id
--------------------------------------------------------------------------------
1 12345007 None 4 None
[root@xsdxs pulp]# katello --username admin --password admin activation_key info --name 12345007 --org ACME_Corporation
--------------------------------------------------------------------------------
Activation Key Info
--------------------------------------------------------------------------------
Id: 1
Name: 12345007
Description:
None
Environment Id: 4
System Template Id: None
Pools:
[ 8ac149d334a786380134abbfa6a70096 ]
|