From f6f6bea1f9a5d78cb967999589e5a84e4238aaeb Mon Sep 17 00:00:00 2001 From: Dave Wapstra Date: Sat, 2 Mar 2024 07:29:05 +1300 Subject: [PATCH] Add warning on import failure --- connector/src/yang/connector/netconf.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/connector/src/yang/connector/netconf.py b/connector/src/yang/connector/netconf.py index 612bdb3..83399c2 100644 --- a/connector/src/yang/connector/netconf.py +++ b/connector/src/yang/connector/netconf.py @@ -16,21 +16,22 @@ from ncclient.devices.default import DefaultDeviceHandler from ncclient.operations.errors import TimeoutExpiredError +# create a logger for this module +logger = logging.getLogger(__name__) + try: from pyats.connections import BaseConnection from pyats.utils.secret_strings import to_plaintext from pyats.log.utils import banner from pyats.log import TaskLogFormatter -except ImportError: +except ImportError as e: + logger.warning(f'Unable to import pyATS packages: {e}') class BaseConnection: pass from .settings import Settings -# create a logger for this module -logger = logging.getLogger(__name__) - nccl = logging.getLogger("ncclient") # The 'Sending' messages are logged at level INFO. # The 'Received' messages are logged at level DEBUG.