Merge "Replace runSaltProcessStep by cmdRun"
diff --git a/src/com/mirantis/mcp/Validate.groovy b/src/com/mirantis/mcp/Validate.groovy
index f4ad5bc..e0317a8 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}")
@@ -713,21 +730,24 @@
tempest_endpoint_type="internalURL", tempest_version="",
conf_script_path="", ext_variables = []) {
def salt = new com.mirantis.mk.Salt()
+ def common = new com.mirantis.mk.Common()
if (testing_tools_repo != "" ) {
+ workdir = ''
if (testing_tools_repo.contains('http://') || testing_tools_repo.contains('https://')) {
salt.cmdRun(master, target, "docker exec cvp git clone ${testing_tools_repo} cvp-configuration")
configure_script = conf_script_path != "" ? conf_script_path : "cvp-configuration/configure.sh"
}
else {
configure_script = testing_tools_repo
+ workdir = ' -w /var/lib/'
}
ext_variables.addAll("PROXY=${proxy}", "TEMPEST_REPO=${tempest_repo}",
"TEMPEST_ENDPOINT_TYPE=${tempest_endpoint_type}",
"tempest_version=${tempest_version}")
- salt.cmdRun(master, target, "docker exec -e " + ext_variables.join(' -e ') + " cvp bash -c ${configure_script}")
+ salt.cmdRun(master, target, "docker exec -e " + ext_variables.join(' -e ') + " ${workdir} cvp bash -c ${configure_script}")
}
else {
- common.infoMsg("TOOLS_REPO is empty, no confguration is needed for container")
+ common.infoMsg("TOOLS_REPO is empty, no configuration is needed for this container")
}
}
diff --git a/src/com/mirantis/mk/Orchestrate.groovy b/src/com/mirantis/mk/Orchestrate.groovy
index 02af05d..15de301 100644
--- a/src/com/mirantis/mk/Orchestrate.groovy
+++ b/src/com/mirantis/mk/Orchestrate.groovy
@@ -890,9 +890,18 @@
} else {
common.errorMsg('[ERROR] Elasticsearch VIP port could not be retrieved')
}
+ pillar = salt.getPillar(master, "I@elasticsearch:client ${extra_tgt}", 'elasticsearch:client:server:scheme')
+ def elasticsearch_scheme
+ if(!pillar['return'].isEmpty()) {
+ elasticsearch_scheme = pillar['return'][0].values()[0]
+ } else {
+ common.infoMsg('No pillar with Elasticsearch server scheme, using http')
+ elasticsearch_scheme = "http"
+ }
+
common.retry(step_retries,step_retries_wait) {
common.infoMsg('Waiting for Elasticsearch to become green..')
- salt.cmdRun(master, "I@elasticsearch:client ${extra_tgt}", "curl -sf ${elasticsearch_vip}:${elasticsearch_port}/_cat/health | awk '{print \$4}' | grep green")
+ salt.cmdRun(master, "I@elasticsearch:client ${extra_tgt}", "curl -skf ${elasticsearch_scheme}://${elasticsearch_vip}:${elasticsearch_port}/_cat/health | awk '{print \$4}' | grep green")
}
salt.enforceState([saltId: master, target: "I@elasticsearch:client ${extra_tgt}", state: 'elasticsearch.client', retries: step_retries, retries_wait: step_retries_wait])