Don't fall when just loading octaviav2 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: I37bc581b10aa2876597dd2bc6b51015ee31cc4f2
Related-Issue: https://mirantis.jira.com/browse/PROD-27276
(cherry picked from commit ce6159b430d455b3febdf039138c1ce074de9b39)
diff --git a/_modules/octaviav2/common.py b/_modules/octaviav2/common.py
index 7cccf0b..ddc8138 100644
--- a/_modules/octaviav2/common.py
+++ b/_modules/octaviav2/common.py
@@ -1,7 +1,13 @@
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__)
@@ -39,6 +45,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 = 'load-balancer'
config = os_client_config.OpenStackConfig()
cloud = config.get_one_cloud(cloud_name)