Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1410920 - Setting relationship data for generic objects in automate does not work
Summary: Setting relationship data for generic objects in automate does not work
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: GA
: 5.8.0
Assignee: Lucy Fu
QA Contact: Milan Falešník
Depends On:
Blocks: 1411357
TreeView+ depends on / blocked
Reported: 2017-01-06 20:53 UTC by Satoe Imaishi
Modified: 2017-06-12 16:20 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1411357 (view as bug list)
Last Closed: 2017-06-12 16:20:10 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:

Attachments (Terms of Use)
Test domain (3.21 KB, application/zip)
2017-01-27 09:37 UTC, Milan Falešník
no flags Details

Description Satoe Imaishi 2017-01-06 20:53:36 UTC
From PR: https://github.com/ManageIQ/manageiq/pull/11811

Generic Object relationships are defined and implemented for AR objects.
Generic Object methods are defined as for AR objects and implemented in automate model.

Converting the object into AR model object when calling the generic object methods from automate as these methods are defined as AR model methods.

Converting the object into service model object when returning the generic object method results back to automate.

ManageIQ issue: https://github.com/ManageIQ/manageiq/issues/11728

The following script fails to add the service to the services relationship for a generic object.

go_class = $evm.vmdb(:generic_object_definition).find_by(:name => "LoadBalancer")
load_balancer = go_class.create_object(:name => "Test Load Balancer")

service = $evm.vmdb(:service).first
load_balancer.services = [service]

Comment 3 Milan Falešník 2017-01-27 09:37:11 UTC
Created attachment 1245071 [details]
Test domain

Use the attached domain to test this bug:

1) Import end enable the domain
2) Have at least one service created (Generic is enough)
3) Run rails console and create the object definition:
  :name => "LoadBalancer", 
  :properties => {
    :attributes   => {:location => "string"},
    :associations => {:vms => "Vm", :services => "Service"},
4) Run tail -fn0 log/automation.log | egrep 'ERROR|XYZ'
5) Simulate Request/GOTest with method execution

In the tail'ed log:
There should be no ERROR lines related to the execution.
There should be these two lines:
<AEMethod gotest> XYZ go object: #<MiqAeServiceGenericObject ....something...>
<AEMethod gotest> XYZ load balancer got service: #<MiqAeServiceService:....something....>
If there is "XYZ load balancer got service: nil", then this bug was reproduced.

thx @lfu

Comment 4 Milan Falešník 2017-03-03 14:46:57 UTC
Verified in using the steps in comment 3

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