ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [20/50] [abbrv] ambari git commit: AMBARI-13578. Set 20 second timeout for Ranger REST API calls
Date Wed, 04 Nov 2015 13:36:47 GMT
AMBARI-13578. Set 20 second timeout for Ranger REST API calls


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bb5c8975
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bb5c8975
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bb5c8975

Branch: refs/heads/branch-dev-patch-upgrade
Commit: bb5c8975f3215dcb5a13ee0ae3a08c9453031fb1
Parents: 715437a
Author: Gautam Borad <gautam@apache.org>
Authored: Wed Oct 21 12:40:30 2015 +0530
Committer: Gautam Borad <gautam@apache.com>
Committed: Tue Nov 3 11:07:45 2015 +0530

----------------------------------------------------------------------
 .../libraries/functions/ranger_functions.py           | 14 +++++++-------
 .../libraries/functions/ranger_functions_v2.py        | 10 +++++-----
 .../RANGER_KMS/0.5.0.2.3/package/scripts/kms.py       |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bb5c8975/ambari-common/src/main/python/resource_management/libraries/functions/ranger_functions.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/ranger_functions.py
b/ambari-common/src/main/python/resource_management/libraries/functions/ranger_functions.py
index dcf59c1..4beeca9 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/ranger_functions.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/ranger_functions.py
@@ -61,7 +61,7 @@ class Rangeradmin:
       request.add_header("Content-Type", "application/json")
       request.add_header("Accept", "application/json")
       request.add_header("Authorization", "Basic {0}".format(base64string))
-      result = urllib2.urlopen(request)
+      result = urllib2.urlopen(request, timeout=20)
       response_code = result.getcode()
       response = json.loads(result.read())
       if response_code == 200 and len(response['vXRepositories']) > 0:
@@ -144,7 +144,7 @@ class Rangeradmin:
       }
       request = urllib2.Request(searchRepoURL, data, headers)
       request.add_header("Authorization", "Basic {0}".format(base64string))
-      result = urllib2.urlopen(request)
+      result = urllib2.urlopen(request, timeout=20)
       response_code = result.getcode()
       response = json.loads(json.JSONEncoder().encode(result.read()))
       if response_code == 200:
@@ -195,7 +195,7 @@ class Rangeradmin:
     return: Returns login check response 
     """
     try:
-      response = urllib2.urlopen(url)
+      response = urllib2.urlopen(url, timeout=20)
       response_code = response.getcode()
       return response_code
     except urllib2.URLError, e:
@@ -223,7 +223,7 @@ class Rangeradmin:
       request.add_header("Content-Type", "application/json")
       request.add_header("Accept", "application/json")
       request.add_header("Authorization", "Basic {0}".format(base64string))
-      result = urllib2.urlopen(request)
+      result = urllib2.urlopen(request, timeout=20)
       response_code = result.getcode()
       response = json.loads(result.read())
       if response_code == 200 and len(response['vXPolicies']) > 0:
@@ -257,7 +257,7 @@ class Rangeradmin:
       request = urllib2.Request(searchRepoURL, data, headers)
       request.add_header("Authorization", "Basic {0}".format(base64string))
       request.get_method = lambda: 'PUT'
-      result = urllib2.urlopen(request)
+      result = urllib2.urlopen(request, timeout=20)
       response_code = result.getcode()
       response = json.loads(json.JSONEncoder().encode(result.read()))
       if response_code == 200:
@@ -320,7 +320,7 @@ class Rangeradmin:
       request.add_header("Content-Type", "application/json")
       request.add_header("Accept", "application/json")
       request.add_header("Authorization", "Basic {0}".format(base64string))
-      result = urllib2.urlopen(request)
+      result = urllib2.urlopen(request, timeout=20)
       response_code = result.getcode()
       response = json.loads(result.read())
       if response_code == 200 and len(response['vXUsers']) >= 0:
@@ -352,7 +352,7 @@ class Rangeradmin:
           }
           request = urllib2.Request(url, data, headers)
           request.add_header("Authorization", "Basic {0}".format(base64string))
-          result = urllib2.urlopen(request)
+          result = urllib2.urlopen(request, timeout=20)
           response_code =  result.getcode()
           response = json.loads(json.JSONEncoder().encode(result.read()))
           if response_code == 200 and response is not None:

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb5c8975/ambari-common/src/main/python/resource_management/libraries/functions/ranger_functions_v2.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/ranger_functions_v2.py
b/ambari-common/src/main/python/resource_management/libraries/functions/ranger_functions_v2.py
index b79f6d8..328cf7f 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/ranger_functions_v2.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/ranger_functions_v2.py
@@ -60,7 +60,7 @@ class RangeradminV2:
       request.add_header("Content-Type", "application/json")
       request.add_header("Accept", "application/json")
       request.add_header("Authorization", "Basic {0}".format(base_64_string))
-      result = urllib2.urlopen(request)
+      result = urllib2.urlopen(request, timeout=20)
       response_code = result.getcode()
       response = json.loads(result.read())
       if response_code == 200 and len(response) > 0:
@@ -136,7 +136,7 @@ class RangeradminV2:
       }
       request = urllib2.Request(search_repo_url, data, headers)
       request.add_header("Authorization", "Basic {0}".format(base_64_string))
-      result = urllib2.urlopen(request)
+      result = urllib2.urlopen(request, timeout=20)
       response_code = result.getcode()
       response = json.loads(json.JSONEncoder().encode(result.read()))
 
@@ -163,7 +163,7 @@ class RangeradminV2:
     :return: Returns login check response 
     """
     try:
-      response = urllib2.urlopen(url)
+      response = urllib2.urlopen(url, timeout=20)
       response_code = response.getcode()
       return response_code
     except urllib2.URLError, e:
@@ -193,7 +193,7 @@ class RangeradminV2:
       request.add_header("Content-Type", "application/json")
       request.add_header("Accept", "application/json")
       request.add_header("Authorization", "Basic {0}".format(base_64_string))
-      result = urllib2.urlopen(request)
+      result = urllib2.urlopen(request, timeout=20)
       response_code = result.getcode()
       response = json.loads(result.read())
       if response_code == 200 and len(response['vXUsers']) >= 0:
@@ -225,7 +225,7 @@ class RangeradminV2:
           }
           request = urllib2.Request(url, data, headers)
           request.add_header("Authorization", "Basic {0}".format(base_64_string))
-          result = urllib2.urlopen(request)
+          result = urllib2.urlopen(request, timeout=20)
           response_code =  result.getcode()
           response = json.loads(json.JSONEncoder().encode(result.read()))
           if response_code == 200 and response is not None:

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb5c8975/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
index 4c5bd1a..1714f06 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
@@ -352,7 +352,7 @@ def create_repo(url, data, usernamepassword):
     }
     request = urllib2.Request(base_url, data, headers)
     request.add_header("Authorization", "Basic {0}".format(base64string))
-    result = urllib2.urlopen(request)
+    result = urllib2.urlopen(request, timeout=20)
     response_code = result.getcode()
     response = json.loads(json.JSONEncoder().encode(result.read()))
     if response_code == 200:
@@ -373,7 +373,7 @@ def get_repo(url, name, usernamepassword):
     request.add_header("Content-Type", "application/json")
     request.add_header("Accept", "application/json")
     request.add_header("Authorization", "Basic {0}".format(base64string))
-    result = urllib2.urlopen(request)
+    result = urllib2.urlopen(request, timeout=20)
     response_code = result.getcode()
     response = json.loads(result.read())
     if response_code == 200 and len(response) > 0:


Mime
View raw message