[CVP] Better handling of offline minion situation for cvp methods
Change-Id: I6022445fa75393dfb5416fd971bbfbbf647ba013
Related-PROD: PROD-22845
diff --git a/src/com/mirantis/mcp/Validate.groovy b/src/com/mirantis/mcp/Validate.groovy
index f4ad5bc..4730a0a 100644
--- a/src/com/mirantis/mcp/Validate.groovy
+++ b/src/com/mirantis/mcp/Validate.groovy
@@ -93,15 +93,26 @@
def salt = new com.mirantis.mk.Salt()
def common = new com.mirantis.mk.Common()
def keystone = []
+ _pillar = false
common.infoMsg("Fetching Keystone v2 credentials")
- _pillar = salt.getPillar(master, 'I@keystone:server', 'keystone:server')['return'][0].values()[0]
- keystone.add("OS_USERNAME=${_pillar.admin_name}")
- keystone.add("OS_PASSWORD=${_pillar.admin_password}")
- keystone.add("OS_TENANT_NAME=${_pillar.admin_tenant}")
- keystone.add("OS_AUTH_URL=http://${_pillar.bind.private_address}:${_pillar.bind.private_port}/v2.0")
- keystone.add("OS_REGION_NAME=${_pillar.region}")
- keystone.add("OS_ENDPOINT_TYPE=admin")
- return keystone
+ _response = salt.runSaltProcessStep(master, 'I@keystone:server', 'pillar.get', 'keystone:server', null, false, 1)['return'][0]
+ for (i = 0; i < _response.keySet().size(); i++) {
+ if ( _response.values()[i] ) {
+ _pillar = _response.values()[i]
+ }
+ }
+ if (_pillar) {
+ keystone.add("OS_USERNAME=${_pillar.admin_name}")
+ keystone.add("OS_PASSWORD=${_pillar.admin_password}")
+ keystone.add("OS_TENANT_NAME=${_pillar.admin_tenant}")
+ keystone.add("OS_AUTH_URL=http://${_pillar.bind.private_address}:${_pillar.bind.private_port}/v2.0")
+ keystone.add("OS_REGION_NAME=${_pillar.region}")
+ keystone.add("OS_ENDPOINT_TYPE=admin")
+ return keystone
+ }
+ else {
+ throw new Exception("Cannot fetch Keystone v2 credentials. Response: ${_response}")
+ }
}
/**
@@ -111,9 +122,15 @@
def _get_keystone_creds_v3(master){
def salt = new com.mirantis.mk.Salt()
def common = new com.mirantis.mk.Common()
+ _pillar = false
pillar_name = 'keystone:client:os_client_config:cfgs:root:content:clouds:admin_identity'
common.infoMsg("Fetching Keystone v3 credentials")
- def _pillar = salt.getPillar(master, 'I@keystone:client', pillar_name)['return'][0].values()[0]
+ _response = salt.runSaltProcessStep(master, 'I@keystone:server', 'pillar.get', pillar_name, null, false, 1)['return'][0]
+ for (i = 0; i < _response.keySet().size(); i++) {
+ if ( _response.values()[i] ) {
+ _pillar = _response.values()[i]
+ }
+ }
def keystone = []
if (_pillar) {
keystone.add("OS_USERNAME=${_pillar.auth.username}")