Don't fall when just loading ironicv1 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: Ie38b80cb604380a63627b020e49a6a016fcbe8b7
Related-Issue: https://mirantis.jira.com/browse/PROD-26920
diff --git a/_modules/ironicv1/common.py b/_modules/ironicv1/common.py
index b2a6071..11a3fa5 100644
--- a/_modules/ironicv1/common.py
+++ b/_modules/ironicv1/common.py
@@ -1,5 +1,9 @@
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__)
@@ -29,6 +33,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 = 'baremetal'
config = os_client_config.OpenStackConfig()
cloud = config.get_one_cloud(cloud_name)