Don't fall when just loading keystonev3 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: I348746432de0f2c635624e2fe6d627b0da587275
Related-Issue: https://mirantis.jira.com/browse/PROD-26920
(cherry picked from commit 77a7e9ce8caeafa443886da7f3f44df222f3c1fe)
diff --git a/_modules/keystonev3/common.py b/_modules/keystonev3/common.py
index abea33d..e3150ec 100644
--- a/_modules/keystonev3/common.py
+++ b/_modules/keystonev3/common.py
@@ -1,10 +1,15 @@
import logging
-import os_client_config
import functools
import time
from keystoneclient import exceptions as ks_exceptions
+try:
+ import os_client_config
+except ImportError:
+ os_client_config = None
+from salt import exceptions
+
log = logging.getLogger(__name__)
@@ -46,6 +51,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 = 'identity'
config = os_client_config.OpenStackConfig()
cloud = config.get_one_cloud(cloud_name)