Don't fall when just loading gnocchiv1 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: I7527cffa5295143815fe65bd87f3397e2fd114fa
Related-Issue: https://mirantis.jira.com/browse/PROD-26920
diff --git a/_modules/gnocchiv1/common.py b/_modules/gnocchiv1/common.py
index b4ef270..a75c26f 100644
--- a/_modules/gnocchiv1/common.py
+++ b/_modules/gnocchiv1/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 = 'metric'
config = os_client_config.OpenStackConfig()
cloud = config.get_one_cloud(cloud_name)