Don't fall when just loading aodhv2 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: Ic61fece83e8d63fb0dc9440c59ba4ab0a4f8da07
Related-Issue: https://mirantis.jira.com/browse/PROD-26920
diff --git a/_modules/aodhv2/common.py b/_modules/aodhv2/common.py
index e507457..fadb888 100644
--- a/_modules/aodhv2/common.py
+++ b/_modules/aodhv2/common.py
@@ -1,5 +1,10 @@
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 +47,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 = 'alarming'
config = os_client_config.OpenStackConfig()
cloud = config.get_one_cloud(cloud_name)