Bug 1535376

Summary: Unable to create / add new Subnet - User 'admin' is not authorized to access 'Cloud Tenant' record id '0' [cloud_subnet/create]
Product: Red Hat CloudForms Management Engine Reporter: Jan Krocil <jkrocil>
Component: UI - OPSAssignee: Petr Blaho <pblaho>
Status: CLOSED DUPLICATE QA Contact: Ola Pavlenko <opavlenk>
Severity: high Docs Contact:
Priority: high    
Version: 5.8.0CC: cpelland, hkataria, jkrocil, lavenel, maufart, mpovolny, obarenbo, pblaho, sseago
Target Milestone: GA   
Target Release: 5.8.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-24 16:39:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: Openstack Target Upstream Version:
Embargoed:

Description Jan Krocil 2018-01-17 09:23:29 UTC
Description of problem:
SSIA

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

How reproducible:
Always

Steps to Reproduce:
1. Add RHOS provider (e.g. rhos11)
2. Networks > Subnets
3. Configuration > Add a new Cloud Subnet

Actual results:
User 'admin' is not authorized to access 'Cloud Tenant' record id '0' [cloud_subnet/create].

Expected results:
Subnet is created.

Additional info:

production.log extract:
-----------------------
[----] I, [2018-01-17T04:18:37.249315 #2224:bc3824]  INFO -- : Started POST "/cloud_subnet/create/new?button=add" for 127.0.0.1 at 2018-01-17 04:18:37 -0500
[----] I, [2018-01-17T04:18:37.253380 #2224:bc3824]  INFO -- : Processing by CloudSubnetController#create as JS
[----] I, [2018-01-17T04:18:37.253561 #2224:bc3824]  INFO -- :   Parameters: {"name"=>"asd", "ems_id"=>"", "cloud_tenant_id"=>"", "network_id"=>"", "dhcp_enabled"=>"true", "network_protocol"=>"ipv4", "gateway"=>
"asdasd", "cidr"=>"sdsadas", "button"=>"add", "id"=>"new"}
[----] F, [2018-01-17T04:18:37.277792 #2224:bc3824] FATAL -- : Error caught: [RuntimeError] User 'admin' is not authorized to access 'Cloud Tenant' record id '0'
/opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-ec5a5651edb1/app/controllers/mixins/checked_id_mixin.rb:63:in `find_record_with_rbac'
/opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-ec5a5651edb1/app/controllers/cloud_subnet_controller.rb:284:in `new_form_params'
/opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-ec5a5651edb1/app/controllers/cloud_subnet_controller.rb:101:in `create'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/abstract_controller/base.rb:188:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_controller/metal/rendering.rb:30:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:126:in `call'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:455:in `call'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:90:in `run_callbacks'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/abstract_controller/callbacks.rb:19:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_controller/metal/rescue.rb:20:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/notifications.rb:164:in `block in instrument'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/notifications.rb:164:in `instrument'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
/opt/rh/cfme-gemset/gems/activerecord-5.0.3/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/abstract_controller/base.rb:126:in `process'
/opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/rendering.rb:30:in `process'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_controller/metal.rb:190:in `dispatch'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_controller/metal.rb:262:in `dispatch'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/routing/route_set.rb:32:in `serve'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/journey/router.rb:39:in `block in serve'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/journey/router.rb:26:in `each'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/journey/router.rb:26:in `serve'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/routing/route_set.rb:725:in `call'
/opt/rh/cfme-gemset/gems/secure_headers-3.0.3/lib/secure_headers/middleware.rb:10:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.3/lib/rack/etag.rb:25:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.3/lib/rack/conditional_get.rb:38:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.3/lib/rack/head.rb:12:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:232:in `context'
/opt/rh/cfme-gemset/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:226:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/middleware/cookies.rb:613:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:90:in `run_callbacks'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/middleware/callbacks.rb:36:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
/opt/rh/cfme-gemset/gems/railties-5.0.3/lib/rails/rack/logger.rb:36:in `call_app'
/opt/rh/cfme-gemset/gems/railties-5.0.3/lib/rails/rack/logger.rb:26:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/middleware/request_id.rb:24:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.3/lib/rack/method_override.rb:22:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.3/lib/rack/runtime.rb:22:in `call'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.3/lib/action_dispatch/middleware/executor.rb:12:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.3/lib/rack/sendfile.rb:111:in `call'
/opt/rh/cfme-gemset/gems/railties-5.0.3/lib/rails/engine.rb:522:in `call'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/puma-3.3.0/lib/puma/configuration.rb:224:in `call'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/puma-3.3.0/lib/puma/server.rb:561:in `handle_request'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/puma-3.3.0/lib/puma/server.rb:406:in `process_client'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/puma-3.3.0/lib/puma/server.rb:271:in `block in run'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/puma-3.3.0/lib/puma/thread_pool.rb:111:in `block in spawn_thread'
[----] I, [2018-01-17T04:18:37.280342 #2224:bc3824]  INFO -- :   Rendered /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-ec5a5651edb1/app/views/layouts/_exception_contents.html.haml (1.2ms)
[----] I, [2018-01-17T04:18:37.281190 #2224:bc3824]  INFO -- : Completed 200 OK in 27ms (Views: 2.8ms | ActiveRecord: 3.2ms)

Comment 2 Scott Seago 2018-01-18 15:54:28 UTC
I'm unable to reproduce this in my development environment. I can create a subnet with no errors. The log for the POST request is somewhat suspicious, though:

[----] I, [2018-01-17T04:18:37.253561 #2224:bc3824]  INFO -- :   Parameters: {"name"=>"asd", "ems_id"=>"", "cloud_tenant_id"=>"", "network_id"=>"", "dhcp_enabled"=>"true", "network_protocol"=>"ipv4", "gateway"=>
"asdasd", "cidr"=>"sdsadas", "button"=>"add", "id"=>"new"}

When I tried using these values for cidr, gateway, etc. I got the expected validation error (sdsadas is not a valid cidr). However, this post is missing ems_id, cloud_tenant_id, and network_id. I could not submit this way, since the 'Add' button was disabled until I'd chosen the EMS, Tenant, and Network.

It sounds like at one point the logic around enabling and disabling the 'Add' button was not working properly.

Is this still happening?

Comment 4 Scott Seago 2018-01-18 17:41:35 UTC
It looks like this is a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1533011

That's why we're not seeing it on either the 5.8.3 branch or on master.

Comment 5 Scott Seago 2018-01-18 17:46:52 UTC
With https://bugzilla.redhat.com/show_bug.cgi?id=1533011 the reported bug was that the "Network" field was missing -- Cloud Tenant was missing as well. This bug reported here is happening due to the missing fields. With the fix in that bug, I'm unable to submit the form until selecting a Tenant and Network, and when I do select them, I'm able to create subnets.