Merge "Revert "Remove useless conditions for vsphere and OS demo""
diff --git a/src/com/mirantis/mk/KaasUtils.groovy b/src/com/mirantis/mk/KaasUtils.groovy
index d30f361..3b89809 100644
--- a/src/com/mirantis/mk/KaasUtils.groovy
+++ b/src/com/mirantis/mk/KaasUtils.groovy
@@ -483,37 +483,23 @@
     }
 
     def jobResults = []
-    jobs["kaas-core-openstack-patched-${component}"] = {
-        try {
-            common.infoMsg('Deploy: patched KaaS demo with Openstack provider')
-            os_job_info = build job: "kaas-testing-core-openstack-workflow-${component}", parameters: parameters, wait: true
-            def build_description = os_job_info.getDescription()
-            def build_result = os_job_info.getResult()
-            jobResults.add(build_result)
+    if (triggers.osDemoEnabled) {
+        jobs["kaas-core-openstack-patched-${component}"] = {
+            try {
+                common.infoMsg('Deploy: patched KaaS demo with Openstack provider')
+                os_job_info = build job: "kaas-testing-core-openstack-workflow-${component}", parameters: parameters, wait: true
+                def build_description = os_job_info.getDescription()
+                def build_result = os_job_info.getResult()
+                jobResults.add(build_result)
 
-            if (build_description) {
-                currentBuild.description += build_description
+                if (build_description) {
+                    currentBuild.description += build_description
+                }
+            } finally {
+                common.infoMsg('Patched KaaS demo with Openstack provider finished')
             }
-        } finally {
-            common.infoMsg('Patched KaaS demo with Openstack provider finished')
         }
     }
-    jobs["kaas-core-vsphere-patched-${component}"] = {
-        try {
-            common.infoMsg('Deploy: patched KaaS demo with VSPHERE provider')
-            vsphere_job_info = build job: "kaas-testing-core-vsphere-workflow-${component}", parameters: parameters, wait: true
-            def build_description = vsphere_job_info.getDescription()
-            def build_result = vsphere_job_info.getResult()
-            jobResults.add(build_result)
-
-            if (build_description) {
-                currentBuild.description += build_description
-            }
-        } finally {
-            common.infoMsg('Patched KaaS demo with VSPHERE provider finished')
-        }
-    }
-
     if (triggers.awsOnDemandDemoEnabled) {
         common.infoMsg('AWS demo triggered, need to sync artifacts in the public-ci cdn..')
         switch (component) {
@@ -541,6 +527,23 @@
             }
         }
     }
+    if (triggers.vsphereDemoEnabled) {
+        jobs["kaas-core-vsphere-patched-${component}"] = {
+            try {
+                common.infoMsg('Deploy: patched KaaS demo with VSPHERE provider')
+                vsphere_job_info = build job: "kaas-testing-core-vsphere-workflow-${component}", parameters: parameters, wait: true
+                def build_description = vsphere_job_info.getDescription()
+                def build_result = vsphere_job_info.getResult()
+                jobResults.add(build_result)
+
+                if (build_description) {
+                    currentBuild.description += build_description
+                }
+            } finally {
+                common.infoMsg('Patched KaaS demo with VSPHERE provider finished')
+            }
+        }
+    }
 
     common.infoMsg('Trigger KaaS demo deployments according to defined provider set')
     if (jobs.size() == 0) {