Don't fall when just loading manilang 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: I38f7fc30a8eeca1c9637f00af51b33f599ac0279
Related-Issue: https://mirantis.jira.com/browse/PROD-26920
diff --git a/_modules/manilang/common.py b/_modules/manilang/common.py
index 47bcfd8..511bd98 100644
--- a/_modules/manilang/common.py
+++ b/_modules/manilang/common.py
@@ -15,7 +15,11 @@
import logging
-import os_client_config
+try:
+ import os_client_config
+except ImportError:
+ os_client_config = None
+from salt import exceptions
MANILA_HEADER = 'X-OpenStack-Manila-API-Version'
@@ -46,6 +50,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 = 'sharev2'
adapter = os_client_config.make_rest_client(service_type,
cloud=cloud_name)