Improved working with spaces in cluster names for test-salt-models pipeline
Change-Id: Ifd4762dd8d30ddbf3e55c9fa831d1e61ede2bccc
diff --git a/test-salt-models-pipeline.groovy b/test-salt-models-pipeline.groovy
index 8de3d94..ca07fc1 100644
--- a/test-salt-models-pipeline.groovy
+++ b/test-salt-models-pipeline.groovy
@@ -181,8 +181,8 @@
// list of cluster names can be explicitly given
if (testClusterNames != null && testClusterNames != "") {
common.infoMsg("TEST_CLUSTER_NAMES param found, using explicitly defined cluster names: ${testClusterNames}")
- def clusterNameRegex = testClusterNames.tokenize(",").join("|")
- infraYMLs = sh(script:"set +x;find ./classes/ -regextype posix-egrep -regex '.*cluster/(${clusterNameRegex}){1}/[infra/]*init\\.yml' -exec grep -il 'cluster_name' {} \\;", returnStdout: false).tokenize()
+ def clusterNameRegex = testClusterNames.tokenize(",").collect{it.trim()}.join("|")
+ infraYMLs = sh(script:"set +x;find ./classes/ -regextype posix-egrep -regex '.*cluster/(${clusterNameRegex}){1}/[infra/]*init\\.yml' -exec grep -il 'cluster_name' {} \\;", returnStdout: true).tokenize()
} else {
common.infoMsg("TEST_CLUSTER_NAMES param not found, all clusters with enabled tests will be tested")
// else we want to test all cluster levels found