rundeck-plugins / ansible-plugin

Ansible Integration for Rundeck
MIT License
329 stars 99 forks source link

RSE-824: Fix: Error handler not working as expected with Ansible Node Step #343

Closed L2JE closed 9 months ago

L2JE commented 9 months ago

Problem:

The ansible plugin is throwing a NodeStepException with a failureData map that has a null value in a field:

e.getFailureData() == [
"message" : "ERROR: Ansible execution returned with non zero code.",
"ansible-config" : null
]

This is happening because when building failure data in the plugin, it’s trying to use theansible-config-file-path property which isn’t part of the AnsiblePlaybookInlineWorkflowNodeStep description.

This map must not have any null values because:

When the step execution finishes, the context logger tries to create a map<String,String> with the mentioned result data by calling the toString() method on each value. This results in a NullPointerException which isn't catched by the BaseWorkflowExecutor (for not being a StepException) not adding this error to the step result, thus, not running the error handler.

Expected Outcome:

the ansible plugin should not return null values on the StepException failure data map and not use properties that are not part of the plugin description

Proposed Solution:

Use the configuration map for the ansible-config field when an exception is cached in the plugin.