Bug 1322983 - when a user in a child tenant executes create_provision_request the miq_request has the wrong tenant id
Summary: when a user in a child tenant executes create_provision_request the miq_reque...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Provisioning
Version: 5.5.0
Hardware: All
OS: All
high
high
Target Milestone: GA
: 5.8.0
Assignee: mkanoor
QA Contact: Pavol Kotvan
URL:
Whiteboard: tenant_cfme:catalog:provision
Depends On: 1429964
Blocks: 1327725 1346969 1382766
TreeView+ depends on / blocked
 
Reported: 2016-03-31 20:16 UTC by Kevin Morey
Modified: 2017-06-12 16:44 UTC (History)
9 users (show)

Fixed In Version: 5.8.0.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1327725 1346969 1382766 (view as bug list)
Environment:
Last Closed: 2017-06-12 16:44:30 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Kevin Morey 2016-03-31 20:16:24 UTC
Description of problem:
When a user that resides in a child tenant submits a create_provision_request from a generic service catalog item they cannot see the miq_provision_request in the Services / Requests page because the miq_provision_request for some reason is being assigned to the wrong tenant.  This is currently affecting anyone using "build_request" in a CF multi-tenancy environment.

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

How reproducible:
100%

Steps to Reproduce:
1. Create a child tenant 
2. Create a group with self-service role and child tenant
3. Create a user associated to group
4. Create a service catalog item that runs create_provision_request

I.e.
args = ["1.1", {"guid"=>"043b2e64-eb15-11e5-b658-5254001018da", "name"=>"cirros"}, {"customization_template_id"=>"7", "security_groups"=>"44", "number_of_vms"=>"1", "cloud_tenant"=>"1", "vm_name"=>"changeme", "guest_access_key_pair"=>"39", "cloud_network"=>"14", "instance_type"=>"56", "number_of_sockets"=>"1", "cores_per_socket"=>"1", "vm_memory"=>"512", "retirement"=>"604800", "retirement_warn"=>"259200"}, {"user_name"=>"clouduser1", "owner_first_name"=>"cloud", "owner_last_name"=>"user1", "owner_email"=>"clouduser1.com"}, {"environment"=>"dev", "cloud_tenant"=>"project1", "flavor"=>"m1.tiny", "prov_scope"=>"tenant1"}, {"provider_id"=>"6", "flavor"=>"m1.tiny", "group_id"=>"19", "group_name"=>"group_tenant1", "cloud_tenant_id"=>"1", "guest_access_key_pair_name"=>"test-key", "cloud_network_name"=>"project1-private", "service_id"=>"55", "service_guid"=>"0a8f3a14-f5cc-11e5-b2d3-5254001018da", "environment"=>"dev", "cloud_tenant"=>"project1", "prov_scope"=>"tenant1"}, nil, nil]

request = $evm.execute('create_provision_request', *args)

5. You will see the service_template_provision_request is owned by the correct user and group and tenant. Yeah!
6. However after create_provision_request runs it creates a miq_provision_request and in the pg database it shows the correct user, group and the tenant id from the parent tenant.
7. What does this mean? If means that users living in sub-tenants cannot see their requests in the Services / Requests queue.



Actual results:
Users cannot see their miq_provision_requests

Expected results:
Users should see their miq_provision_requests

Additional info:

Comment 3 Greg McCullough 2016-04-05 12:59:58 UTC
Tina - Will need to work with Madhu on this one.  Would be good to get an environment setup to reproduce.

Comment 7 CFME Bot 2016-09-27 16:35:55 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/159a98bd7b0dcb84439fc315af254fa797616b8d

commit 159a98bd7b0dcb84439fc315af254fa797616b8d
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Wed Sep 21 17:04:03 2016 -0400
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Tue Sep 27 11:23:03 2016 -0400

    Set the User.current_user in Automation Engine
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1322983

 lib/miq_automation_engine/engine/miq_ae_service.rb         |  3 +++
 lib/miq_automation_engine/engine/miq_ae_workspace.rb       |  1 +
 .../engine/miq_ae_workspace_runtime_spec.rb                | 14 ++++++++++++++
 3 files changed, 18 insertions(+)
 create mode 100644 spec/lib/miq_automation_engine/engine/miq_ae_workspace_runtime_spec.rb


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