Bug 1678136

Summary: [RFE] As an Service Designer, I should be able to pass variables between Catalog Items in a Bundle
Product: Red Hat CloudForms Management Engine Reporter: Loic Avenel <lavenel>
Component: AutomateAssignee: Lucy Fu <lufu>
Status: CLOSED ERRATA QA Contact: Niyaz Akhtar Ansari <nansari>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: high    
Version: unspecifiedCC: ghubale, lufu, mfeifer, mkanoor, nansari, obarenbo, pmcgowan, simaishi, tfitzger
Target Milestone: GAKeywords: RFE
Target Release: 5.11.0Flags: ghubale: needinfo-
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.16 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-12 13:35:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:

Description Loic Avenel 2019-02-18 08:02:45 UTC
As an Service Designer, I should be able to pass variables between Catalog Items in a Bundle

Comment 3 Tina Fitzgerald 2019-06-07 17:06:50 UTC
Hi Loic, Peter,

Can you add more detail here?

Thanks,
Tina

Comment 4 Loic Avenel 2019-06-09 17:55:28 UTC
In general, we need a mechanism to pass Parameters between Catalog Items within a bundle. For example if the first Catalog Item create a VM, you need to have the IP/Hostname for the next Catalog Item that will configure the fresh created VM.

Comment 6 CFME Bot 2019-07-23 12:18:21 UTC
New commit detected on ManageIQ/manageiq-automation_engine/master:

https://github.com/ManageIQ/manageiq-automation_engine/commit/a8eb5a3130be272ac94d33a7e1886f47f76725c2
commit a8eb5a3130be272ac94d33a7e1886f47f76725c2
Author:     Lucy Fu <lufu>
AuthorDate: Mon Jul 15 14:04:55 2019 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Mon Jul 15 14:04:55 2019 -0400

    Add service_vars to pass variables between catalog items in a bundle

    https://bugzilla.redhat.com/show_bug.cgi?id=1678136

 lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service.rb | 31 +
 lib/miq_automation_engine/service_models/miq_ae_service_service.rb | 25 +
 spec/miq_ae_service_spec.rb | 57 +
 3 files changed, 113 insertions(+)

Comment 8 Lucy Fu 2019-08-05 16:10:59 UTC
1 Create a service bundle with two service items A and B
2 Create two instances and methods check_service_var and set_service_var in  /service/provisioning/statemachines/methods
3 Rename the entry point for service item A and B in /service/provisioning/statemachines/ServiceProvision_Template
4 Add a call to /service/provisioning/statemachines/methods/set_service_var in the entry point for service item A
5 Add a call to /service/provisioning/statemachines/methods/check_service_var in the entry point for service item B

In set_service_var method:
$evm.set_service_var('test_service_var', "test value for service var")

In check_service_var method:
var = $evm.service_var_exist?('test_service_var') && $evm.get_service_var('test_service_var')
$evm.log("info", "service var: test_service_var = #{var}")

Comment 14 Ganesh Hubale 2019-08-13 10:24:02 UTC
Hi Lucy,

Sorry, I did not get your comment 12 that's why I was getting same error provided in comment 13

But now I followed comment 12 and changed the call to service_var_exists? in check_service_var method.

I am getting desired output in automation logs and catalog bundle is getting provisioned successfully.

Automation Logs:
================

[root@host-192-168-200-16 vmdb]# tail -f log/automation.log | grep "service var:"

[----] I, [2019-08-13T06:02:40.680200 #7770:2ab3d1d46ea8]  INFO -- : Q-task_id([r7_service_template_provision_task_20]) <AEMethod check_service_var> service var: test_service_var = test value for service var
[----] I, [2019-08-13T06:08:50.198314 #1034:2ab3d33b70d4]  INFO -- : Q-task_id([r7_service_template_provision_task_20]) <AEMethod check_service_var> service var: test_service_var = test value for service var

Comment 16 errata-xmlrpc 2019-12-12 13:35:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:4199