Merge "Add openstack_keystone_security to cc context"
diff --git a/jobs/pipelines/deploy-cicd-and-run-tests.groovy b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
index fb039d3..567ddc6 100644
--- a/jobs/pipelines/deploy-cicd-and-run-tests.groovy
+++ b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
@@ -111,6 +111,8 @@
     }
 }
 
+
+timeout(time: 15, unit: 'HOURS') {
 // main
 // Temporary disable throttle to check how it will run
 //throttle(['fuel_devops_environment']) {
@@ -184,4 +186,5 @@
   } // node
 
 
-//}
\ No newline at end of file
+//}
+} // timeout
diff --git a/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy b/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
index 86b5122..e689a40 100644
--- a/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
+++ b/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
@@ -40,6 +40,7 @@
 
 currentBuild.description = "${PARENT_NODE_NAME}:${ENV_NAME}"
 
+timeout(time: 2, unit: 'HOURS') {
 node ("${PARENT_NODE_NAME}") {
     if (! fileExists("${PARENT_WORKSPACE}")) {
         error "'PARENT_WORKSPACE' contains path to non-existing directory ${PARENT_WORKSPACE} on the node '${PARENT_NODE_NAME}'."
@@ -154,4 +155,5 @@
             }
         }
     }
-}
\ No newline at end of file
+}
+} // timeout
diff --git a/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy b/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
index 0d497ab..d59995e 100644
--- a/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
+++ b/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
@@ -50,6 +50,7 @@
 def ubuntu_vcp_image_name = "ubuntu-vcp-${MCP_VERSION}"
 def ubuntu_foundation_image_name = "ubuntu-16.04-foundation-${MCP_VERSION}"
 
+timeout(time: 2, unit: 'HOURS') {
 node ("${PARENT_NODE_NAME}") {
     if (! fileExists("${PARENT_WORKSPACE}")) {
         error "'PARENT_WORKSPACE' contains path to non-existing directory ${PARENT_WORKSPACE} on the node '${PARENT_NODE_NAME}'."
@@ -317,3 +318,4 @@
         } // withCredentials
     } // dir
 } // node
+} // timeout
diff --git a/jobs/pipelines/swarm-create-cfg-config-drive.groovy b/jobs/pipelines/swarm-create-cfg-config-drive.groovy
index 86b9eec..2c16eb4 100644
--- a/jobs/pipelines/swarm-create-cfg-config-drive.groovy
+++ b/jobs/pipelines/swarm-create-cfg-config-drive.groovy
@@ -27,6 +27,7 @@
     m.collect {k, v -> [k, v]}
 }
 
+timeout(time: 2, unit: 'HOURS') {
 node (node_name) {
 
   timestamps(){
@@ -247,3 +248,4 @@
     }
   }
 }
+} // timeout
\ No newline at end of file
diff --git a/jobs/pipelines/swarm-deploy-cicd.groovy b/jobs/pipelines/swarm-deploy-cicd.groovy
index dd2df11..6014b9e 100644
--- a/jobs/pipelines/swarm-deploy-cicd.groovy
+++ b/jobs/pipelines/swarm-deploy-cicd.groovy
@@ -99,4 +99,4 @@
 
         } // dir
     } // node
-}
\ No newline at end of file
+} // timeout
diff --git a/jobs/pipelines/swarm-deploy-platform.groovy b/jobs/pipelines/swarm-deploy-platform.groovy
index 277ed0a..ca4b16c 100644
--- a/jobs/pipelines/swarm-deploy-platform.groovy
+++ b/jobs/pipelines/swarm-deploy-platform.groovy
@@ -93,4 +93,4 @@
 
         } // dir
     } // node
-}
\ No newline at end of file
+} // timeout
\ No newline at end of file
diff --git a/jobs/pipelines/swarm-run-pytest.groovy b/jobs/pipelines/swarm-run-pytest.groovy
index fdcb2c9..ee341ae 100644
--- a/jobs/pipelines/swarm-run-pytest.groovy
+++ b/jobs/pipelines/swarm-run-pytest.groovy
@@ -33,6 +33,7 @@
 
 currentBuild.description = "${PARENT_NODE_NAME}:${ENV_NAME}"
 
+timeout(time: 10, unit: 'HOURS') {
 node ("${PARENT_NODE_NAME}") {
     if (! fileExists("${PARENT_WORKSPACE}")) {
         error "'PARENT_WORKSPACE' contains path to non-existing directory ${PARENT_WORKSPACE} on the node '${PARENT_NODE_NAME}'."
@@ -114,3 +115,4 @@
         }
     }
 }
+} // timeout
diff --git a/jobs/pipelines/swarm-testrail-report.groovy b/jobs/pipelines/swarm-testrail-report.groovy
index 2d2f993..38a7968 100644
--- a/jobs/pipelines/swarm-testrail-report.groovy
+++ b/jobs/pipelines/swarm-testrail-report.groovy
@@ -26,6 +26,7 @@
 
 currentBuild.description = "${PARENT_NODE_NAME}:${ENV_NAME}"
 
+timeout(time: 2, unit: 'HOURS') {
 node ("${PARENT_NODE_NAME}") {
     if (! fileExists("${PARENT_WORKSPACE}")) {
         error "'PARENT_WORKSPACE' contains path to non-existing directory ${PARENT_WORKSPACE} on the node '${PARENT_NODE_NAME}'."
@@ -225,3 +226,4 @@
         }
     }
 }
+} // timeout
diff --git a/tcp_tests/managers/envmanager_heat.py b/tcp_tests/managers/envmanager_heat.py
index 7432bd5..d6d7e90 100644
--- a/tcp_tests/managers/envmanager_heat.py
+++ b/tcp_tests/managers/envmanager_heat.py
@@ -526,7 +526,7 @@
             fields['environment_files'] = env_files_list
 
         self.__stacks.create(**fields)
-        self.wait_of_stack_status(EXPECTED_STACK_STATUS)
+        self.wait_of_stack_status(EXPECTED_STACK_STATUS, tries=140)
         LOG.info("Stack '{0}' created"
                  .format(self.__config.hardware.heat_stack_name))
 
diff --git a/tcp_tests/managers/saltmanager.py b/tcp_tests/managers/saltmanager.py
index a33bb11..617323a 100644
--- a/tcp_tests/managers/saltmanager.py
+++ b/tcp_tests/managers/saltmanager.py
@@ -285,26 +285,33 @@
         if not settings.SKIP_SYNC_TIME:
             cmd = ('service ntp stop;'
                    'if systemctl is-active --quiet maas-rackd; then'
-                   '  systemctl stop maas-rackd; RACKD=true;'
-                   'else'
-                   '  RACKD=false;'
+                   '  systemctl stop maas-rackd;'
+                   '  touch /tmp/maas-rackd.work;'
                    'fi;'
                    'if systemctl is-active --quiet maas-regiond; then'
-                   '  systemctl stop maas-regiond; REGIOND=true;'
-                   'else'
-                   '  REGIOND=false;'
+                   '  systemctl stop maas-regiond;'
+                   '  touch /tmp/maas-regiond.work;'
                    'fi;'
+                   'if systemctl is-active --quiet maas-proxy; then'
+                   '  systemctl stop maas-proxy;'
+                   '  touch /tmp/maas-proxy.work;'
+                   'fi;'
+                   'sleep 3;'
                    'if [ -x /usr/sbin/ntpdate ]; then'
                    '  ntpdate -s ntp.ubuntu.com;'
                    'else'
                    '  ntpd -gq;'
                    'fi;'
                    'service ntp start;'
-                   'if $RACKD; then systemctl start maas-rackd; fi;'
-                   'if $REGIOND; then systemctl start maas-regiond; fi;')
+                   'if [ -f /tmp/maas-proxy.work ]; then'
+                   '  systemctl start maas-proxy; fi;'
+                   'if [ -f /tmp/maas-rackd.work ]; then'
+                   '  systemctl start maas-rackd; fi;'
+                   'if [ -f /tmp/maas-regiond.work ]; then'
+                   '  systemctl start maas-regiond; fi;')
             self.run_state(
                 tgt,
-                'cmd.run', cmd)  # noqa
+                'cmd.run', cmd, timeout=3600)  # noqa
         new_time_res = self.run_state(tgt, 'cmd.run', 'date')
         for node_name, time in sorted(new_time_res[0]['return'][0].items()):
             LOG.info("{0}: {1}".format(node_name, time))