Replace underscores in JOB_NAME by hyphen

Arrangment JOB_NAME and STACK_NAME to be checked properly for
MAX_PERMITTED_STACKS check.

Change-Id: I023ebf67ccecea4a15efe5bd709677abbc4da7e2
diff --git a/cloud-deploy-pipeline.groovy b/cloud-deploy-pipeline.groovy
index b7e22a8..3c8846c 100644
--- a/cloud-deploy-pipeline.groovy
+++ b/cloud-deploy-pipeline.groovy
@@ -133,7 +133,7 @@
                 //
                 wrap([$class: 'BuildUser']) {
                     if (env.BUILD_USER_ID && !env.BUILD_USER_ID.equals("jenkins") && !STACK_REUSE.toBoolean()) {
-                        def existingStacks = openstack.getStacksForNameContains(openstackCloud, "${env.BUILD_USER_ID}-${JOB_NAME}", venv)
+                        def existingStacks = openstack.getStacksForNameContains(openstackCloud, "${env.BUILD_USER_ID}-${JOB_NAME}".replaceAll('_', '-'), venv)
                         if (existingStacks.size() >= _MAX_PERMITTED_STACKS) {
                             STACK_DELETE = "false"
                             throw new Exception("You cannot create new stack, you already have ${_MAX_PERMITTED_STACKS} stacks of this type (${JOB_NAME}). \nStack names: ${existingStacks}")