Don't fall when just loading runtest modules

this avoids loading warnings on salt-master that may not have
os-client-config installed, as salt tries to load them irrespective of
__virtual__() result.

Change-Id: I99f9e6c44c0715087a92ec2684ce8a6250429243
Related-Issue: https://mirantis.jira.com/browse/PROD-26920
(cherry picked from commit 63fcb96f7bd4a1f5595b081c4de11e678d85bf32)
diff --git a/_modules/runtest/conditions.py b/_modules/runtest/conditions.py
index 05fe24e..5eb4763 100644
--- a/_modules/runtest/conditions.py
+++ b/_modules/runtest/conditions.py
@@ -1,4 +1,9 @@
-import jsonpath_rw as jsonpath
+try:
+    import jsonpath_rw as jsonpath
+except ImportError:
+    jsonpath = None
+from salt import exceptions
+
 import operator
 
 
@@ -19,6 +24,10 @@
 class BaseRule(object):
 
     def __init__(self, field, op, val, multiple='first'):
+        if not jsonpath:
+            raise exceptions.SaltInvocationError(
+                "Cannot load jsonpath_rw. Please check your environment "
+                "configuration.")
         self.field = field
         self.op = op
         self.value = val
diff --git a/_modules/runtest/tempest_sections/base_section.py b/_modules/runtest/tempest_sections/base_section.py
index 5e2ea3a..b2c12ca 100644
--- a/_modules/runtest/tempest_sections/base_section.py
+++ b/_modules/runtest/tempest_sections/base_section.py
@@ -1,6 +1,11 @@
 
 import abc
-import jsonpath_rw as jsonpath
+
+try:
+    import jsonpath_rw as jsonpath
+except ImportError:
+    jsonpath = None
+from salt import exceptions
 
 import salt
 
@@ -9,6 +14,10 @@
 class BaseSection(object):
 
     def __init__(self, pillar, runtest_opts):
+        if not jsonpath:
+            raise exceptions.SaltInvocationError(
+                "Cannot load jsonpath_rw. Please check your environment "
+                "configuration.")
         super(BaseSection, self).__init__()
         self.pillar = pillar
         self.runtest_opts = runtest_opts