ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlun...@apache.org
Subject ambari git commit: AMBARI-11739: fixed a repo creation issue when repo creation is called from multiple server simultaneously (Selvamohan Neethiraj via jluniya)
Date Fri, 05 Jun 2015 22:27:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 4afac3006 -> f42450910


AMBARI-11739: fixed a repo creation issue when repo creation is called from multiple server
simultaneously (Selvamohan Neethiraj via jluniya)


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

Branch: refs/heads/trunk
Commit: f4245091058f8b1e6a1bd094f147134f9305dd82
Parents: 4afac30
Author: Jayush Luniya <jluniya@hortonworks.com>
Authored: Fri Jun 5 15:27:51 2015 -0700
Committer: Jayush Luniya <jluniya@hortonworks.com>
Committed: Fri Jun 5 15:27:51 2015 -0700

----------------------------------------------------------------------
 .../libraries/functions/ranger_functions.py     | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f4245091/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 54be2c4..e4b1744 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
@@ -87,15 +87,23 @@ class Rangeradmin:
       ambari_ranger_admin, ambari_ranger_password = self.create_ambari_admin_user(ambari_ranger_admin,
ambari_ranger_password, format("{admin_uname}:{admin_password}"))
       ambari_username_password_for_ranger = ambari_ranger_admin + ':' + ambari_ranger_password
       if ambari_ranger_admin != '' and ambari_ranger_password != '':
-        repo = self.get_repository_by_name_urllib2(repo_name, component, 'true', ambari_username_password_for_ranger)
-        if repo and repo['name'] == repo_name:
-          Logger.info('{0} Repository exist'.format(component.title()))
-        else:
-          response = self.create_repository_urllib2(repo_data, ambari_username_password_for_ranger,
policy_user)
-          if response is not None:
-            Logger.info('{0} Repository created in Ranger admin'.format(component.title()))
+        retryCount = 0
+        while retryCount <= 5:
+          repo = self.get_repository_by_name_urllib2(repo_name, component, 'true', ambari_username_password_for_ranger)
+          if repo and repo['name'] == repo_name:
+            Logger.info('{0} Repository exist'.format(component.title()))
+            break
           else:
-            raise Fail('{0} Repository creation failed in Ranger admin'.format(component.title()))
+            response = self.create_repository_urllib2(repo_data, ambari_username_password_for_ranger,
policy_user)
+            if response is not None:
+              Logger.info('{0} Repository created in Ranger admin'.format(component.title()))
+              break
+            else:
+              if retryCount < 5:
+                Logger.info("Retry Repository Creation is being called")
+                retryCount += 1
+              else:
+                raise Fail('{0} Repository creation failed in Ranger admin'.format(component.title()))
       else:
         raise Fail('Ambari admin username and password are blank ')
           


Mime
View raw message