Bug 1734630

Summary: [RFE] set_stats - Support setting service_var from set_stats with naming convention
Product: Red Hat CloudForms Management Engine Reporter: Loic Avenel <lavenel>
Component: AutomateAssignee: Lucy Fu <lufu>
Status: CLOSED ERRATA QA Contact: Gaurav Talreja <gtalreja>
Severity: medium Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: high    
Version: 5.12.0CC: dmetzger, gmccullo, lufu, mfeifer, mkanoor, mshriver, obarenbo, simaishi
Target Milestone: GAKeywords: FutureFeature, RFE, ZStream
Target Release: 5.11.7Flags: simaishi: cfme-5.11.z+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.7.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-08-06 14:32:52 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-07-31 06:52:48 UTC
[RFE] set_stats - Support setting service_var from set_stats with naming convention

Comment 2 Tina Fitzgerald 2019-10-31 18:29:22 UTC
Hi Lucy,

Using set_stats in a playbook:

set_stats value: service_var__var1

1. Sets the ansible_stat state var is currently supports.
2. Create/Updates a service_var with the name of ansible_stat_var1

Let me know if you have any questions.

Thanks,
Tina

Comment 4 CFME Bot 2019-12-17 15:31:58 UTC
New commit detected on ManageIQ/manageiq-automation_engine/master:

https://github.com/ManageIQ/manageiq-automation_engine/commit/bc3d8a38842653add6575f2d639a5763bafc115a
commit bc3d8a38842653add6575f2d639a5763bafc115a
Author:     Lucy Fu <lufu>
AuthorDate: Thu Oct 24 15:06:06 2019 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Thu Oct 24 15:06:06 2019 -0400

    Update service_vars from playbook set_stats data.

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

 lib/miq_automation_engine/engine/miq_ae_engine/miq_ae_ansible_method_base.rb | 20 +
 spec/miq_ae_playbook_method_spec.rb | 10 +-
 2 files changed, 29 insertions(+), 1 deletion(-)

Comment 5 CFME Bot 2020-06-22 21:06:08 UTC
New commit detected on ManageIQ/manageiq-automation_engine/ivanchuk:

https://github.com/ManageIQ/manageiq-automation_engine/commit/f678811278a43c4ee12d531eae4a68e6cc1fea71
commit f678811278a43c4ee12d531eae4a68e6cc1fea71
Author:     tina <tfitzger>
AuthorDate: Tue Dec 17 15:27:05 2019 +0000
Commit:     Satoe Imaishi <simaishi>
CommitDate: Mon Jun 22 21:04:58 2020 +0000

    Merge pull request #399 from lfu/service_vars_with_set_stats

    Update service_vars with playbook set_stats data.

    (cherry picked from commit 6bcb57c032f4fd6a581abf6c0932c687585846e8)

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

 lib/miq_automation_engine/engine/miq_ae_engine/miq_ae_ansible_method_base.rb | 20 +
 spec/miq_ae_playbook_method_spec.rb | 10 +-
 2 files changed, 29 insertions(+), 1 deletion(-)

Comment 7 Lucy Fu 2020-07-17 16:50:33 UTC
Requirement for this BZ:
  2. set_stats - Support setting service_var from set_stats with naming convention.
  for example: set_stats value: service_var__var1 would set the ansible_stat state var is currently supports, but in addition 
  would set a service_var with the same value. The service_var name would be ansible_stat_var1

The first playbook might look similar to this:
- hosts: localhost
  tasks:
    - name: "Artifact data of test results to next playbook"
      set_stats:
        data:
          service_var__var1: "secret"
It has access to a service object and updates the options hash of its root service object with :service_vars => {'ansible_stats_var1' => 'secret'}

Then when the second playbook runs, it would be able to access this value of options[:service_vars]['ansible_stats_var1] from root service object.

Comment 12 errata-xmlrpc 2020-08-06 14:32:52 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 (Critical: CloudForms 5.0.7 bug fix and enhancement update), 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/RHSA-2020:3358