Don't fall when just loading heatv1 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: I56871fec52e656d764e95ca2e93f10fe97d6a3c6
Related-Issue: https://mirantis.jira.com/browse/PROD-26920
diff --git a/_modules/heatv1/common.py b/_modules/heatv1/common.py
index 06eabff..3859ca7 100644
--- a/_modules/heatv1/common.py
+++ b/_modules/heatv1/common.py
@@ -2,7 +2,10 @@
import six
import uuid
-import os_client_config
+try:
+ import os_client_config
+except ImportError:
+ os_client_config = None
from salt import exceptions
@@ -12,6 +15,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.")
config = os_client_config.OpenStackConfig()
cloud = config.get_one_cloud(cloud_name)
adapter = cloud.get_session_client(SERVICE_KEY)
@@ -106,4 +113,4 @@
uuid = resp[0]['id']
return func(uuid, *args[start_arg:], **kwargs)
return wrapped_f
- return wrap
\ No newline at end of file
+ return wrap