Revert "Revert "Refactored test salt formulas env pipeline""

This reverts commit de64efee0d184733f8e1020fd6df69bfbd7cb099.

Change-Id: Ia260cf511421b2d53fb198452c2e4a472668476b
diff --git a/test-salt-formulas-env.groovy b/test-salt-formulas-env.groovy
index 64b089e..1f646b9 100644
--- a/test-salt-formulas-env.groovy
+++ b/test-salt-formulas-env.groovy
@@ -62,14 +62,10 @@
           common.infoMsg("Running part of kitchen test")
           if (KITCHEN_ENV != null && !KITCHEN_ENV.isEmpty() && KITCHEN_ENV != "") {
             def cleanEnv = KITCHEN_ENV.replaceAll("\\s?SUITE=[^\\s]*", "")
-            def suitePattern = java.util.regex.Pattern.compile("\\s?SUITE=([^\\s]*)")
-            def suiteMatcher = suitePattern.matcher(KITCHEN_ENV)
-            if (suiteMatcher.find()) {
-              def suite = suiteMatcher.group(1)
-              suiteMatcher = null
-              def cleanSuite = suite.replaceAll("_", "-")
+            def suite = ruby.getSuiteName(KITCHEN_ENV)
+            if (suite && suite != "") {
               common.infoMsg("Running kitchen test with environment:" + KITCHEN_ENV.trim())
-              ruby.runKitchenTests(cleanEnv, cleanSuite)
+              ruby.runKitchenTests(cleanEnv, suite)
             } else {
               common.warningMsg("No SUITE was found. Running with all suites.")
               ruby.runKitchenTests(cleanEnv, "")
@@ -93,4 +89,4 @@
       println readFile(".kitchen/logs/kitchen.log")
     }
   }
-}
\ No newline at end of file
+}