From b753e8dc48ea390b33a9c366165d36a2a27ec692 Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Fri, 16 Sep 2016 11:28:45 -0400 Subject: [PATCH] Add simple checks for libraries to junos --- lib/ansible/module_utils/junos.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ansible/module_utils/junos.py b/lib/ansible/module_utils/junos.py index de52a663aef..2b1ba49faf2 100644 --- a/lib/ansible/module_utils/junos.py +++ b/lib/ansible/module_utils/junos.py @@ -72,6 +72,16 @@ def xml_to_string(val): class Netconf(object): def __init__(self): + if not HAS_PYEZ: + raise NetworkError( + msg='junos-eznc >= 1.2.2 is required but does not appear to be installed. ' + 'It can be installed using `pip install junos-eznc`' + ) + if not HAS_JXMLEASE: + raise NetworkError( + msg='jxmlease is required but does not appear to be installed. ' + 'It can be installed using `pip install jxmlease`' + ) self.device = None self.config = None self._locked = False