Don't fall when just loading glancev2 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: I2cd07cd7d69efedd606386e27f0bcc5f9436ed6c
Related-Issue: https://mirantis.jira.com/browse/PROD-26920
diff --git a/_modules/glancev2/common.py b/_modules/glancev2/common.py
index 79d93a0..2ba50bf 100644
--- a/_modules/glancev2/common.py
+++ b/_modules/glancev2/common.py
@@ -1,7 +1,12 @@
import logging
-import os_client_config
from uuid import UUID
+try:
+ import os_client_config
+except ImportError:
+ os_client_config = None
+from salt import exceptions
+
log = logging.getLogger(__name__)
@@ -43,6 +48,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 = 'image'
config = os_client_config.OpenStackConfig()
cloud = config.get_one_cloud(cloud_name)