ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gau...@apache.org
Subject [2/2] ambari git commit: Revert "AMBARI-18026 : Restart of plugin enabled services fails in secured env with Ranger HA.(gautam)"
Date Fri, 05 Aug 2016 13:17:53 GMT
Revert "AMBARI-18026 : Restart of plugin enabled services fails in secured env with Ranger
HA.(gautam)"

This reverts commit 851a5d2e0a526ead09d2aff393614eb8ecf69c9c.


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

Branch: refs/heads/trunk
Commit: 15c0a7f2f305feb91e1f0d85da14b2e5664f97b9
Parents: 8dcfa03
Author: Gautam Borad <gautam@apache.org>
Authored: Fri Aug 5 18:47:37 2016 +0530
Committer: Gautam Borad <gautam@apache.org>
Committed: Fri Aug 5 18:47:37 2016 +0530

----------------------------------------------------------------------
 .../libraries/functions/ranger_functions_v2.py  | 41 ++------------------
 .../RANGER_KMS/0.5.0.2.3/package/scripts/kms.py |  5 +--
 2 files changed, 4 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/15c0a7f2/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 6a236fb..5c3a3bb 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
@@ -144,15 +144,12 @@ class RangeradminV2:
         repo_data = json.dumps(repo_properties)
         while retryCount <= 5:
           response = self.get_repository_by_name_curl(component_user,component_user_keytab,component_user_principal,repo_name,
component, 'true')
-          if response is not None and ('exists' in str(response).lower() or 'name' in str(response).lower()):
+          if response is not None:
             Logger.info('{0} Repository {1} exist'.format(component.title(), (response['name'])))
             break
-          elif response is not None and 'error' in str(response).lower():
-            Logger.error('Ranger service get failed.')
-            break
           else:
             response = self.create_repository_curl(component_user,component_user_keytab,component_user_principal,repo_name,
repo_data,policy_user)
-            if response is not None and len(response) > 0:
+            if response and len(response) > 0:
               Logger.info('{0} Repository created in Ranger admin'.format(component.title()))
               break
             else:
@@ -333,7 +330,7 @@ class RangeradminV2:
 
 
 
-  @safe_retry(times=5, sleep_time=8, backoff_factor=1.5, err_class=Fail, return_on_fail='error')
+  @safe_retry(times=5, sleep_time=8, backoff_factor=1.5, err_class=Fail, return_on_fail=None)
   def get_repository_by_name_curl(self, component_user, component_user_keytab, component_user_principal,
name, component, status, is_keyadmin = False):
     """
     :param component_user: service user for which call is to be made
@@ -350,22 +347,6 @@ class RangeradminV2:
       if is_keyadmin:
         search_repo_url = '{0}&suser=keyadmin'.format(search_repo_url)
       response,error_message,time_in_millis = self.call_curl_request(component_user,component_user_keytab,component_user_principal,search_repo_url,False,request_method='GET')
-      if ('http' in response.lower() and ('401' in response.lower() and ('authentication
failed' in response.lower() or 'unauthorized' in response.lower()))):
-        raise Fail('Ranger get call Error: HTTP RESPONSE CODE 401.')
-      elif ('http' in response.lower() and ('400' in response.lower() or 'bad request' in
response.lower())):
-        raise Fail('Ranger get call Error: HTTP RESPONSE CODE 400.')
-      elif ('http' in response.lower() and ('403' in response.lower() or 'forbidden' in response.lower())):
-        raise Fail('Ranger get call Error: HTTP RESPONSE CODE 403.')
-      elif ('http' in response.lower() and ('404' in response.lower() or 'not found' in response.lower())):
-        raise Fail('Ranger get call Error: HTTP RESPONSE CODE 404.')
-      elif ('http' in response.lower() and ('419' in response.lower() or 'session expired'
in response.lower())):
-        raise Fail('Ranger get call Error: HTTP RESPONSE CODE 419.')
-      elif ('http' in response.lower() and ('500' in response.lower() or 'server error' in
response.lower())):
-        raise Fail('Ranger get call Error: HTTP RESPONSE CODE 500.')
-      elif ('http' in response.lower() and ('307' in response.lower() or 'forbidden' in response.lower())):
-        raise Fail('Ranger get call Error: HTTP RESPONSE CODE 307.')
-      elif 'exists' in response.lower():
-        return response
       response_stripped = response[1:len(response) - 1]
       if response_stripped and len(response_stripped) > 0:
         response_json = json.loads(response_stripped)
@@ -398,22 +379,6 @@ class RangeradminV2:
       method = 'POST'
 
       response,error_message,time_in_millis = self.call_curl_request(component_user,component_user_keytab,component_user_principal,search_repo_url,False,method,data,header)
-      if ('http' in response.lower() and ('401' in response.lower() and ('authentication
failed' in response.lower() or 'unauthorized' in response.lower()))):
-        raise Fail('Ranger create call Error: HTTP RESPONSE CODE 401.')
-      elif ('http' in response.lower() and ('400' in response.lower() or 'bad request' in
response.lower())):
-        raise Fail('Ranger create call Error: HTTP RESPONSE CODE 400.')
-      elif ('http' in response.lower() and ('403' in response.lower() or 'forbidden' in response.lower())):
-        raise Fail('Ranger create call Error: HTTP RESPONSE CODE 403.')
-      elif ('http' in response.lower() and ('404' in response.lower() or 'not found' in response.lower())):
-        raise Fail('Ranger create call Error: HTTP RESPONSE CODE 404.')
-      elif ('http' in response.lower() and ('419' in response.lower() or 'session expired'
in response.lower())):
-        raise Fail('Ranger create call Error: HTTP RESPONSE CODE 419.')
-      elif ('http' in response.lower() and ('500' in response.lower() or 'server error' in
response.lower())):
-        raise Fail('Ranger create call Error: HTTP RESPONSE CODE 500.')
-      elif ('http' in response.lower() and ('307' in response.lower() or 'forbidden' in response.lower())):
-        raise Fail('Ranger create call Error: HTTP RESPONSE CODE 307.')
-      elif 'exists' in response.lower():
-        return response
       if response and len(response) > 0:
         response_json = json.loads(response)
         if 'name' in response_json and response_json['name'].lower() == name.lower():

http://git-wip-us.apache.org/repos/asf/ambari/blob/15c0a7f2/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 ca2ef9f..0a8c7d3 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
@@ -577,12 +577,9 @@ def check_ranger_service_support_kerberos(user, keytab, principal):
 
   if response_code is not None and response_code[0] == 200:
     get_repo_name_response = ranger_adm_obj.get_repository_by_name_curl(user, keytab, principal,
params.repo_name, 'kms', 'true', is_keyadmin = True)
-    if get_repo_name_response is not None and ('exist' in str(get_repo_name_response).lower()
or 'name' in str(get_repo_name_response).lower()):
+    if get_repo_name_response is not None:
       Logger.info('KMS repository {0} exist'.format(get_repo_name_response['name']))
       return True
-    elif get_repo_name_response is not None and 'error' in str(get_repo_name_response).lower():
-      Logger.error('Ranger service get failed.')
-      return False
     else:
       create_repo_response = ranger_adm_obj.create_repository_curl(user, keytab, principal,
params.repo_name, json.dumps(params.kms_ranger_plugin_repo), None, is_keyadmin = True)
       if create_repo_response is not None and len(create_repo_response) > 0:


Mime
View raw message