Bug 757094

Summary: Showing a detail of a repo fails with exception
Product: Red Hat Satellite Reporter: Ivan Necas <inecas>
Component: APIAssignee: Ivan Necas <inecas>
Status: CLOSED CURRENTRELEASE QA Contact: Garik Khachikyan <gkhachik>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.1CC: bkearney, gkhachik, lzap, mkoci
Target Milestone: UnspecifiedKeywords: 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:08:54 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    

Description Ivan Necas 2011-11-25 13:19:04 UTC
Calling CLI:
kk repo info --env Dev --name "Red Hat Enterprise Linux 6 Server RPMs 6Server x86_64" --product "Red Hat Enterprise Linux Server"

Caueses the following exception:

NoMethodError: undefined method `where' for #<Array:0x7fdc3f8d8718>
/home/inecas/Projects/RedHat/katello/src/app/controllers/api/products_controller.rb:58:in `repositories'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/abstract_controller/base.rb:150:in `process_action'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_controller/metal/rendering.rb:11:in `process_action'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/abstract_controller/callbacks.rb:18:in `process_action'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:462:in `_run__569591491__process_action__225383425__callbacks'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:221:in `_conditional_callback_around_64324'
/home/inecas/Projects/RedHat/katello/src/lib/util/threadsession.rb:79:in `thread_locals'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:220:in `_conditional_callback_around_64324'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:446:in `_run__569591491__process_action__225383425__callbacks'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:410:in `send'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:94:in `send'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:94:in `run_callbacks'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/abstract_controller/callbacks.rb:17:in `process_action'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_controller/metal/rescue.rb:17:in `process_action'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `instrument'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `instrument'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/abstract_controller/base.rb:119:in `process'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/abstract_controller/rendering.rb:41:in `process'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_controller/metal.rb:138:in `dispatch'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_controller/metal.rb:178:in `action'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:62:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:27:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-mount-0.7.1/lib/rack/mount/route_set.rb:150:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:93:in `recognize'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:96:in `optimized_each'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:92:in `recognize'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-mount-0.7.1/lib/rack/mount/route_set.rb:141:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:493:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/warden-1.0.3/lib/warden/manager.rb:35:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/warden-1.0.3/lib/warden/manager.rb:34:in `catch'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/warden-1.0.3/lib/warden/manager.rb:34:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/sass-3.1.4/lib/sass/../sass/plugin/rack.rb:54:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/middleware/head.rb:14:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-1.3.0/lib/rack/methodoverride.rb:24:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/middleware/flash.rb:182:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/middleware/cookies.rb:302:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:32:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:12:in `cache'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:31:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/middleware/callbacks.rb:46:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-1.3.0/lib/rack/sendfile.rb:102:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/railties-3.0.10/lib/rails/rack/logger.rb:13:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-1.3.0/lib/rack/runtime.rb:17:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/activesupport-3.0.10/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-1.3.0/lib/rack/lock.rb:34:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/actionpack-3.0.10/lib/action_dispatch/middleware/static.rb:30:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/railties-3.0.10/lib/rails/application.rb:168:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/railties-3.0.10/lib/rails/application.rb:77:in `send'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/railties-3.0.10/lib/rails/application.rb:77:in `method_missing'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-1.3.0/lib/rack/urlmap.rb:52:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-1.3.0/lib/rack/urlmap.rb:46:in `each'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-1.3.0/lib/rack/urlmap.rb:46:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/railties-3.0.10/lib/rails/rack/log_tailer.rb:14:in `call'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-1.3.0/lib/rack/handler/webrick.rb:59:in `service'
/home/inecas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/home/inecas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/home/inecas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/home/inecas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:162:in `start'
/home/inecas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/home/inecas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:95:in `start'
/home/inecas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:92:in `each'
/home/inecas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:92:in `start'
/home/inecas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:23:in `start'
/home/inecas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:82:in `start'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-1.3.0/lib/rack/handler/webrick.rb:13:in `run'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/rack-1.3.0/lib/rack/server.rb:265:in `start'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/railties-3.0.10/lib/rails/commands/server.rb:65:in `start'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/railties-3.0.10/lib/rails/commands.rb:30
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/railties-3.0.10/lib/rails/commands.rb:27:in `tap'
/home/inecas/.rvm/gems/ruby-1.8.7-p352@katello/gems/railties-3.0.10/lib/rails/commands.rb:27
./script/rails:81:in `require'
./script/rails:81

Comment 2 Ivan Necas 2012-01-27 10:02:51 UTC
The issue changed a little to authorization denial:

katello -u admin -p admin repo info --name "Red Hat Enterprise Linux 6 Server RPMs x86_64 6Server" --product "Red Hat Enterprise Linux Server"
User admin is not allowed to access api/repositories/show

The same happens when enabling and disabling the repo:

katello -u admin -p admin repo enable --name "Red Hat Enterprise Linux 6 Server RPMs x86_64 6Server" --product "Red Hat Enterprise Linux Server"
User admin is not allowed to access api/repositories/show

Comment 3 Lukas Zapletal 2012-01-27 11:21:33 UTC
Strange, it works with custom products. Only RH products are affected.

I have no clue what is wrong. I will try again with clean installation, but I can return to it after Monday.

Comment 6 Ivan Necas 2012-01-27 12:14:56 UTC
It's because product.readable? returns true only if there is some repo enabled (introduced in commit ec906c19abcf1db5d1c80bfd6746778abedc1c45). I don't see the reason why it should behave this way. This also prevents showing product details unless some repo enabled.

@Partha: why we don't consider product without enabled repos readable?

Comment 7 Garik Khachikyan 2012-01-27 12:58:14 UTC
during bug verification please check:
---
kk org subscriptions --name ACME_Corporation
---

as it now throws: "User admin is not allowed to access api/products/show"

Comment 8 Ivan Necas 2012-01-27 13:27:22 UTC
This is also caused by the check on enabled repos on product = subscriptions are assigned to marketing product and marketing products themselves have no repos, neither enabled or disabled.

Comment 9 Ivan Necas 2012-01-30 17:39:48 UTC
After discussions we agreed on product being readable and editable even if it has no enabled repos. Fixed in 17de64b427c107d5b0ff71f10b955a1f198e97fd.

Comment 13 Mike McCune 2013-08-16 17:57:56 UTC
getting rid of 6.0.0 version since that doesn't exist