tharpie / cvprac-auto-reconcile

a script using aristanetworks cvprac library to auto-reconcile nodes on a CloudVision cluster
1 stars 0 forks source link

Handle Device Not Reachable #1

Closed tharpie closed 6 years ago

tharpie commented 6 years ago

If device is not reachable from CVP, the node will be marked as non-compliant. When it's time to run validate_and_compare_configlets, CVP grabs the running configuration. Is the device is not reachable this throws a CvpApiError for the Post method.

We should handle this, alert in stdout and continue on.

Example of Exception that wasn't caught:

Traceback (most recent call last): File "auto-reconcile.py", line 197, in main() File "auto-reconcile.py", line 179, in main reconcile(cvp_client, device) File "auto-reconcile.py", line 125, in reconcile result = validate_and_compare_configlets(client, device_id, configlet_keys) File "auto-reconcile.py", line 64, in validate_and_compare_configlets data=body, timeout=client.api.request_timeout) File "/usr/local/lib/python2.7/site-packages/cvprac/cvp_client.py", line 589, in post return self._make_request('POST', url, timeout, data=data) File "/usr/local/lib/python2.7/site-packages/cvprac/cvp_client.py", line 515, in _make_request raise error cvprac.cvp_client_errors.CvpApiError: POST: https://192.168.51.97:443/web/provisioning/v2/validateAndCompareConfiglets.do : Request Error: Device not reachable

tharpie commented 6 years ago

fixed with commit: d4b9eacfb469e01e504c57d7b048f1cb0ffa3a20