Skip to content

Commit

Permalink
added exception handling on httpx.ReadTimeout (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyschulman authored Sep 26, 2023
1 parent 65f0f48 commit 26c4ef3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion netcam_aioeos/bgp_peering/eos_checks_bgp_peering.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ async def check_neeighbors(
results: CheckResultsCollection = list()
checks = check_collection.checks

dev_data = await dut.api_cache_get(key="bgp-summary", command="show ip bgp summary vrf all")
dev_data = await dut.api_cache_get(
key="bgp-summary", command="show ip bgp summary vrf all"
)

for nei_check in checks:
_check_bgp_neighbor(
Expand Down
4 changes: 3 additions & 1 deletion netcam_aioeos/bgp_peering/eos_checks_bgp_routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ async def check_bgp_neighbors(
checks = check_bgp_routers.checks
dut: EOSDeviceUnderTest = self

dev_data = await dut.api_cache_get(key="bgp-summary", command="show ip bgp summary vrf all")
dev_data = await dut.api_cache_get(
key="bgp-summary", command="show ip bgp summary vrf all"
)

for rtr_chk in checks:
_check_router_vrf(dut=dut, check=rtr_chk, dev_data=dev_data, results=results)
Expand Down
4 changes: 4 additions & 0 deletions netcam_aioeos/config/eos_dcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

from typing import Optional

import httpx

# -----------------------------------------------------------------------------
# Public Imports
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -122,6 +124,8 @@ async def config_check(self, replace: Optional[bool | None] = None) -> str | Non
)
except RuntimeError as exc:
errors = exc.args[0]
except httpx.ReadTimeout:
errors = f"Read timeout after {self.eapi.timeout}. Increase config.timeout"
else:
errors = None

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "netcam-aioeos"
version = "0.6.6"
version = "0.6.7"
description = "NetCAD/CAM - Arista EOS/eAPI asyncio driver"
readme = "README.md"
authors = ["Jeremy Schulman"]
Expand Down

0 comments on commit 26c4ef3

Please sign in to comment.