Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8BFD5185BD for ; Fri, 5 Jun 2015 22:27:57 +0000 (UTC) Received: (qmail 9129 invoked by uid 500); 5 Jun 2015 22:27:57 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 9103 invoked by uid 500); 5 Jun 2015 22:27:57 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 9065 invoked by uid 99); 5 Jun 2015 22:27:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jun 2015 22:27:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5CA1FE0777; Fri, 5 Jun 2015 22:27:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jluniya@apache.org To: commits@ambari.apache.org Message-Id: <9794a6d1a76443f2b6003b9f3595cb27@git.apache.org> X-Mailer: ASF-Git Admin Mailer 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, 5 Jun 2015 22:27:57 +0000 (UTC) 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 Authored: Fri Jun 5 15:27:51 2015 -0700 Committer: Jayush Luniya 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 ')