As an Service Designer, I should be able to pass variables between Catalog Items in a Bundle
Hi Loic, Peter, Can you add more detail here? Thanks, Tina
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.
https://github.com/ManageIQ/manageiq-automation_engine/pull/338
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(+)
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}")
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
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