From db6702f942b0278f0d34db2520bea1df09d35a9b Mon Sep 17 00:00:00 2001 From: Mike Place Date: Fri, 25 Mar 2016 16:23:37 -0600 Subject: [PATCH] Try/catch junos import --- salt/grains/junos.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/salt/grains/junos.py b/salt/grains/junos.py index 6362fcea79..d1a3d303f6 100644 --- a/salt/grains/junos.py +++ b/salt/grains/junos.py @@ -6,7 +6,11 @@ via salt-proxy-minion.Thus, some grains make sense to get them from the minion (PYTHONPATH), but others don't (ip_interfaces) ''' from __future__ import absolute_import -from jnpr.junos.device import Device +HAS_LIBS = True +try: + from jnpr.junos.device import Device +except ImportError: + HAS_LIBS = False import logging __proxyenabled__ = ['junos'] @@ -15,7 +19,7 @@ log = logging.getLogger(__name__) def __virtual__(): - if 'proxy' not in __opts__: + if 'proxy' not in __opts__ or not HAS_LIBS: return False else: return __virtualname__