ansible-aci icon indicating copy to clipboard operation
ansible-aci copied to clipboard

No-verification flag to reduce the number of API calls

Open robvand opened this issue 1 year ago • 2 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The number of client to APIC calls could be reduced by removing the control mechanism that is provided by the second GET request.

If the initial GET returns the object and it matches the values provided in the playbook, no POST is needed. The current behaviour of plugins/module_utils/aci.py is that it will send another GET afterwards. This is not required.

If the initial GET does not return the object or it does not match the values provided in the playbook, a POST is needed. Followed by the POST the client sends another GET. This is only required if you want to validate the change.

The implication of removing the second GET is that no default values set by APIC will be returned.

This new behaviour could be set with a flag to have no impact to existing users.

Collection versions

  • cisco.aci 2.8.0

References

Resource already exists example with two GET requests: image

Resource does not yet exist example with two GET requests: image

robvand avatar Feb 14 '24 13:02 robvand

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

akinross avatar Feb 14 '24 13:02 akinross

We might also want to consider an additional no_look_back flag that even skips the original get_existing() so just POST always.

lhercot avatar Feb 26 '24 19:02 lhercot

Hi @robvand, Thanks for suggesting the above option, I have implemented this solution and just awaiting PR reviews before it gets merged.

samiib avatar Mar 18 '24 10:03 samiib