Don't stuck when salt minion/master is restarted

When applying salt.{master|minion} states salt may be restarted.
As result existed call stuck. This patch allows to set response
timeout for salt api POST calls, and if it is reached, retry it.
Enable retries for all salt.master|salt.api calls with read_timeout=60

Change-Id: Ibdf0f5ce0bc2e4640b7502b0abe71f81557e244d
diff --git a/src/com/mirantis/mk/Http.groovy b/src/com/mirantis/mk/Http.groovy
index c8cc156..7e22ca6 100644
--- a/src/com/mirantis/mk/Http.groovy
+++ b/src/com/mirantis/mk/Http.groovy
@@ -12,10 +12,15 @@
  * @param method    HTTP method to use (default GET)
  * @param data      JSON data to POST or PUT
  * @param headers   Map of additional request headers
+ * @param read_timeout http session read timeout
  */
 @NonCPS
-def sendHttpRequest(url, method = 'GET', data = null, headers = [:]) {
+def sendHttpRequest(url, method = 'GET', data = null, headers = [:], read_timeout=-1) {
     def connection = new URL(url).openConnection()
+
+    if (read_timeout != -1){
+        connection.setReadTimeout(read_timeout*1000)
+    }
     if (method != 'GET') {
         connection.setRequestMethod(method)
     }
@@ -80,9 +85,10 @@
  *
  * @param url     URL which will requested
  * @param data    JSON data to PUT
+ * @param read_timeout http session read timeout
  */
-def sendHttpPostRequest(url, data = null, headers = [:]) {
-    return sendHttpRequest(url, 'POST', data, headers)
+def sendHttpPostRequest(url, data = null, headers = [:], read_timeout=-1) {
+    return sendHttpRequest(url, 'POST', data, headers, read_timeout)
 }
 
 /**