From 8486bebb3bdf08da5ef1ee0f7c707603a515651d Mon Sep 17 00:00:00 2001 From: Matt Griswold Date: Mon, 26 Sep 2016 15:27:33 +0000 Subject: [PATCH 1/2] don't leak eznc connect exceptions --- napalm_junos/junos.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/napalm_junos/junos.py b/napalm_junos/junos.py index 8b1b40f..cb2409a 100644 --- a/napalm_junos/junos.py +++ b/napalm_junos/junos.py @@ -27,7 +27,7 @@ from jnpr.junos.utils.config import Config from jnpr.junos.exception import ConfigLoadError from jnpr.junos.exception import RpcTimeoutError -from jnpr.junos.exception import ConnectTimeoutError +from jnpr.junos.exception import ConnectError # import NAPALM Base import napalm_base.helpers @@ -72,7 +72,7 @@ def open(self): """Open the connection wit the device.""" try: self.device.open() - except ConnectTimeoutError as cte: + except ConnectError as cte: raise ConnectionException(cte.message) self.device.timeout = self.timeout if hasattr(self.device, "cu"): From cebe9c5f055fa3bdc9f6eecf2f0956248cbb6dba Mon Sep 17 00:00:00 2001 From: Matt Griswold Date: Mon, 26 Sep 2016 16:17:22 +0000 Subject: [PATCH 2/2] re-add timeout exception --- napalm_junos/junos.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/napalm_junos/junos.py b/napalm_junos/junos.py index cb2409a..5348eb2 100644 --- a/napalm_junos/junos.py +++ b/napalm_junos/junos.py @@ -28,6 +28,7 @@ from jnpr.junos.exception import ConfigLoadError from jnpr.junos.exception import RpcTimeoutError from jnpr.junos.exception import ConnectError +from jnpr.junos.exception import ConnectTimeoutError # import NAPALM Base import napalm_base.helpers @@ -72,6 +73,8 @@ def open(self): """Open the connection wit the device.""" try: self.device.open() + except ConnectTimeoutError as cte: + raise ConnectionException(cte.message) except ConnectError as cte: raise ConnectionException(cte.message) self.device.timeout = self.timeout