aristanetworks / ansible-cvp

Ansible modules for Arista CloudVision
http://cvp.avd.sh
Apache License 2.0
66 stars 61 forks source link

Feature Request - Add retry mecanism #229

Closed netixx closed 3 years ago

netixx commented 4 years ago

Request Type

Detailed Description

While interacting with CVP, the API may fail temporarily (eg. radius authentication, transient failures due to load of the machine). There may also be transient network or DNS failures.

When this happens, the ansible-cvp module crashes immediately.

This impeeds automations flows, and they need to be restarted from scratch. In complex environment, this wastes a lot of time.

We could add a basic retry mecanism in the code, which retries requests when (some kind) of failures occur.

Context

This is a backend change, nothing would change for the user, except the module would crash less often when retries are enabled.

Add any other context or screenshots about the feature request here.

Possible Implementation

We could add a switch for the number of retries (0 disables the feature, default 3), and output a warning when those errors occurs.

Ansible "recover" blocks are an alternative, but is more complex to implement on the user's side.

titom73 commented 4 years ago

Thanks for opening this issue. Is this issue related to #228 where it seems exception is related to authentication issue ?

netixx commented 4 years ago

Not specifically.

Most of the authentication errors we are getting are during the initial connection/token retrieval (we get "Invalid Crendentials" as a return message in this case). This is where RADIUS authentication occurs (and may fail due to transient RADIUS failure).

titom73 commented 4 years ago

Since all the backend function to communicate with Cloudvision has moved to cvprac library, this feature request should be routed to this repository.

It is best to implement such a mechanism directly in the authentication process instead of per module.

Once the issue will be opened there, I will spend time to submit a PR