ansible-collection-alb
ansible-collection-alb copied to clipboard
avi_api_session does not handle forcedelete paths (i.e. /api/serviceengine/<se_uuid>/forcedelete
Describe the bug
- name: Force Delete a Service Engine
vmware.alb.avi_api_session:
avi_credentials: "{{ AVI_CREDENTIALS }}"
data:
name: foo
http_method: post
timeout: 30
path: "serviceengine/{{ se_uuid }}/forcedelete"
Results in:
vmware.alb.plugins.module_utils.avi_api.APIError: ('HTTP Error: 405 Error Msg {\"detail\": \"Method \\'GET\\' not allowed.\"}', <Response [405]>)\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
It looks like we are hitting this conditional
https://github.com/vmware/ansible-collection-alb/blob/eng/plugins/modules/avi_api_session.py#L199
which should be avoided if we add 'forcedelete' to api_get_not_allowed and sub_api_get_not_allowed on lines 181 and 182, respectively.
I added the above to my local ansible collection and it allowed the post to proceed correctly.
Reproduction steps
- Attempt to use avi_api_session module to POST to an endpoint which includes /forcedelete
Expected behavior
Post is expected to go through unless there is an issue with se_uuid or permissions.
Additional context
No response