CiscoDevNet / ansible-aci

Cisco ACI Ansible Collection
https://galaxy.ansible.com/cisco/aci
GNU General Public License v3.0
143 stars 97 forks source link

httpapi plugin logout handling #607

Closed robvand closed 9 months ago

robvand commented 9 months ago

Community Note

Description

The httpapi connection plugin POSTs aaaLogout in between tasks.

Collection versions

Expected Behavior

One login before first task, optionally a logout after the last task in playbook has completed.

Transitioning from one task to the other should look like this:

image

Actual Behavior

No 154508-154838 sequence shows unwanted plugin behaviour in between tasks:

image

Logout:

image

403 return:

image

Followed by another login with the actual credentials and a 200 OK, but the next task proceeds with the original cookie.

Important Factoids

Commenting out the logout function in https://github.com/CiscoDevNet/ansible-aci/blob/f3b017fa4a47a8cd6aad44233998804c8179d924/plugins/httpapi/aci.py#L105 results in the correct behaviour with the exception of sending a logout after all tasks have completed.

akinross commented 9 months ago

Hi @robvand, thank you for making us aware of this. Have added the issue to the todo items.

shrsr commented 9 months ago

@robvand The logout is being intermittently called due to a line of code in the ansible task executor file as seen below: https://github.com/ansible/ansible/blob/9a8be1e8c84823e35939762098d5c7990a10085b/lib/ansible/executor/task_executor.py#L203C17-L203C41 We removed the logout function from the connection plugin to overcome this like you did in the Factoids above.