You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/01/19 19:27:07 UTC

[12/19] ambari git commit: AMBARI-14710. Add retry logic for REST calls between Ambari and Ranger(gautam)

AMBARI-14710. Add retry logic for REST calls between Ambari and Ranger(gautam)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 869e0858ccd835baa53ec3b88f50439cdecfd2c7
Parents: 58903d8
Author: Gautam Borad <ga...@apache.org>
Authored: Mon Jan 18 22:24:43 2016 +0530
Committer: Gautam Borad <ga...@apache.org>
Committed: Tue Jan 19 09:56:21 2016 +0530

----------------------------------------------------------------------
 .../libraries/functions/ranger_functions.py                  | 8 +++-----
 .../libraries/functions/ranger_functions_v2.py               | 8 +++-----
 2 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/869e0858/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 543a31f..c59dc8d 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
@@ -219,13 +219,11 @@ class Rangeradmin:
       return response_code
     except urllib2.URLError, e:
       if isinstance(e, urllib2.HTTPError):
-        Logger.error("Connection to Ranger Admin failed. Http status code - {0}. \n {1}".format(e.code, e.read()))
+        raise Fail("Connection to Ranger Admin failed. Http status code - {0}. \n {1}".format(e.code, e.read()))
       else:
-        Logger.error("Connection to Ranger Admin failed. Reason - {0}.".format(e.reason))
-      return None
+        raise Fail("Connection to Ranger Admin failed. Reason - {0}.".format(e.reason))
     except httplib.BadStatusLine, e:
-      Logger.error("Ranger Admin service is not reachable, please restart the service and then try again")
-      return None
+      raise Fail("Ranger Admin service is not reachable, please restart the service and then try again")
     except TimeoutError:
       raise Fail("Connection to Ranger Admin failed. Reason - timeout")
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/869e0858/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 80965a6..a72be33 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
@@ -183,13 +183,11 @@ class RangeradminV2:
       return response_code
     except urllib2.URLError, e:
       if isinstance(e, urllib2.HTTPError):
-        Logger.error("Connection failed to Ranger Admin. Http status code - {0}. \n {1}".format(e.code, e.read()))
+        raise Fail("Connection failed to Ranger Admin. Http status code - {0}. \n {1}".format(e.code, e.read()))
       else:
-        Logger.error("Connection failed to Ranger Admin. Reason - {0}.".format(e.reason))
-      return None
+        raise Fail("Connection failed to Ranger Admin. Reason - {0}.".format(e.reason))
     except httplib.BadStatusLine, e:
-      Logger.error("Ranger Admin service is not reachable, please restart the service and then try again")
-      return None
+      raise Fail("Ranger Admin service is not reachable, please restart the service and then try again")
     except TimeoutError:
       raise Fail("Connection failed to Ranger Admin. Reason - timeout")