Skip to content

Commit 2dbaab5

Browse files
authored
Ensure regular expression operations are on strings in ansible tower launch_job method (#136)
* Ensure regular expression operations are on strings in ansible tower launch_ansible_job method + Integer values that are meant to be passed as vars will cause exceptions + Related bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1659092
1 parent 2c703d2 commit 2dbaab5

File tree

1 file changed

+8
-2
lines changed
  • Automate/RedHatConsulting_Utilities/AutomationManagement/AnsibleTower/Operations/StateMachines/Job.class/__methods__

1 file changed

+8
-2
lines changed

Automate/RedHatConsulting_Utilities/AutomationManagement/AnsibleTower/Operations/StateMachines/Job.class/__methods__/launch_ansible_job.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
#
1212
# Related Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1647192
1313
#
14-
# This method can be removed once the bugzilla is addressed.
14+
# Additionally, we are overriding this method to allow integers as well as strings
15+
# to be passed as extra vars to an Tower Job invocation.
16+
#
17+
# Related Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1659092
18+
#
19+
# This method can be removed once these bugzillas are addressed.
1520
#
1621
# This method should be updated if the base launch_ansible_job
1722
# method in the MIQ domain is updates with CFME releases.
@@ -90,7 +95,8 @@ def object_vars(object, ext_vars)
9095
key_list.each_with_object(ext_vars) do |key, hash|
9196
# Override - update method to ensure that 'start_with?' will always operate on a string
9297
if key.to_s.start_with?('param')
93-
match_data = ANSIBLE_VAR_REGEX.match(object[key])
98+
# Override - object[key] may not be string. Add 'to_s' to force string type
99+
match_data = ANSIBLE_VAR_REGEX.match(object[key].to_s)
94100
hash[match_data[1].strip] ||= match_data[2] if match_data
95101
else
96102
# Override - update method to ensure that 'match' is called

0 commit comments

Comments
 (0)