Description of problem: The JSON string created for default value for extra variables defined as dictionary (list of key/value pairs) when generating a service dialog from a Job Template is incorrect. Ansible job template will fail if using the generated default value for extra variable parameters. User need to manually modify the proposed values with the correct JSON string. For example: I have a job template accepting the following extra variables/default values: postgresql_users: - name: test password: test CloudForms creates the following string when a service dialog is generated from the Job Template: "[{\"name\"=>\"test\", \"password\"=>\"test\"}]" The correct extra variable sting should be: "[{\"name\": \"test\",\"password\": \"test\"}]" User needs to manually change the extra variable values in the dialog for the Job Template to run successfully. Version-Release number of selected component (if applicable): 5.6.0.13.20160624114606_13a9153 How reproducible: Always Steps to Reproduce: 1. Create a Job Template in Ansible Tower with extra variable defined as dictionary (list of key/value pairs) and set default values 2. Generate a Service Dialog in CloudForms from the Job Template 3. Add a button launching this job template from a VM/instance with generated dialog Actual results: The job template will fail to run with an error on the Ansible Tower side when parsing the extra variable values, something similar to: FAILED! => {"failed": true, "msg": "'dict object' has no attribute 'password'"} Expected results: The default value in the dialog should have been set correctly. Additional info: For extra variables set as dictionary, the generated string for default values should use ':' character instead of '=>'.
https://github.com/ManageIQ/manageiq/pull/9986
https://github.com/ManageIQ/manageiq/pull/10007
New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/4d82363ce12b53d5c0f5c9d5855beee6ddcd523d commit 4d82363ce12b53d5c0f5c9d5855beee6ddcd523d Author: Bill Wei <bilwei> AuthorDate: Thu Jul 21 14:26:57 2016 -0400 Commit: Drew Bomhof <dbomhof> CommitDate: Fri Jul 22 15:21:03 2016 -0400 Jsonify the default hash value of an extra var https://bugzilla.redhat.com/show_bug.cgi?id=1358048 app/services/ansible_tower_job_template_dialog_service.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/63570343fc631950841e7ef9815279895c449cbc commit 63570343fc631950841e7ef9815279895c449cbc Author: Drew Bomhof <dbomhof> AuthorDate: Fri Jul 22 17:01:23 2016 -0400 Commit: Drew Bomhof <dbomhof> CommitDate: Fri Jul 22 17:22:29 2016 -0400 Check if a ConfigurationScript has variables with instances of a Hash or an Array When creating a service dialog from configuration scripts we were not encoding the contents of a YAML Hash or Array as JSON. This fix resolves that issue by calling to_json on variable values that are instances of a Hash or Array https://bugzilla.redhat.com/show_bug.cgi?id=1358048 app/services/ansible_tower_job_template_dialog_service.rb | 2 +- spec/services/ansible_tower_job_template_dialog_service_spec.rb | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
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://rhn.redhat.com/errata/RHBA-2017-0012.html