Don't fall when just loading designatev2 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: Ib95887c274179130f87d4897e55779bc1c4f6206
Related-Issue: https://mirantis.jira.com/browse/PROD-26920
diff --git a/_modules/designatev2/common.py b/_modules/designatev2/common.py
index 22e8ad3..1bee497 100644
--- a/_modules/designatev2/common.py
+++ b/_modules/designatev2/common.py
@@ -1,5 +1,9 @@
import logging
-import os_client_config
+try:
+ import os_client_config
+except ImportError:
+ os_client_config = None
+from salt import exceptions
log = logging.getLogger(__name__)
@@ -42,6 +46,10 @@
def _get_raw_client(cloud_name):
+ if not os_client_config:
+ raise exceptions.SaltInvocationError(
+ "Cannot load os-client-config. Please check your environment "
+ "configuration.")
service_type = 'dns'
config = os_client_config.OpenStackConfig()
cloud = config.get_one_cloud(cloud_name)