Do not load 'reclass' module w/o 'reclass' python library
Change-Id: Ia845028f7499a5890d5c0759f9b4a589d3aa0c3f
Related: PROD-27273
diff --git a/_modules/reclass.py b/_modules/reclass.py
index a2d79bd..46b2b86 100644
--- a/_modules/reclass.py
+++ b/_modules/reclass.py
@@ -17,13 +17,17 @@
import re
import urlparse
-
-from reclass import get_storage, output
-from reclass.adapters.salt import ext_pillar
-from reclass.core import Core
-from reclass.config import find_and_read_configfile
from string import Template
-from reclass.errors import ReclassException
+
+try:
+ from reclass import get_storage, output
+ from reclass.adapters.salt import ext_pillar
+ from reclass.core import Core
+ from reclass.config import find_and_read_configfile
+ from reclass.errors import ReclassException
+ HAS_RECLASS = True
+except ImportError:
+ HAS_RECLASS = False
LOG = logging.getLogger(__name__)
@@ -34,6 +38,8 @@
Only load this module if reclass
is installed on this minion.
'''
+ if not HAS_RECLASS:
+ return False, "'reclass' python library is unavailable"
return 'reclass'