From fe045ae282c81015efc6a1161ae4a78d6515a6f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Queiroz?= Date: Fri, 16 Jul 2021 23:56:26 -0300 Subject: [PATCH 1/6] adding case for service not found --- intg/src/main/python/apache_ranger/client/ranger_client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/intg/src/main/python/apache_ranger/client/ranger_client.py b/intg/src/main/python/apache_ranger/client/ranger_client.py index 4dfcfbc952..25790dd47e 100644 --- a/intg/src/main/python/apache_ranger/client/ranger_client.py +++ b/intg/src/main/python/apache_ranger/client/ranger_client.py @@ -324,6 +324,11 @@ def __call_api(self, api, query_params=None, request_data=None): LOG.error("Ranger admin unavailable. HTTP Status: %s", HTTPStatus.SERVICE_UNAVAILABLE) ret = None + elif response.status_code == HTTPStatus.SERVICE_NOT_FOUND: + LOG.error("Ranger service not found. HTTP Status: %s", HTTPStatus.SERVICE_UNAVAILABLE) + + ret = None + else: raise RangerServiceException(api, response) From 9540b9a8d7ec6fa163351c1ce7b319526fe84666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Queiroz?= Date: Fri, 16 Jul 2021 23:57:59 -0300 Subject: [PATCH 2/6] add HTTPStatus for SERVICE_UNAVAILABLE case --- intg/src/main/python/apache_ranger/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/intg/src/main/python/apache_ranger/utils.py b/intg/src/main/python/apache_ranger/utils.py index a564aaf1ce..8695116680 100644 --- a/intg/src/main/python/apache_ranger/utils.py +++ b/intg/src/main/python/apache_ranger/utils.py @@ -89,5 +89,6 @@ class HttpMethod(enum.Enum): class HTTPStatus: OK = 200 NO_CONTENT = 204 + SERVICE_NOT_FOUND = 404 INTERNAL_SERVER_ERROR = 500 SERVICE_UNAVAILABLE = 503 From dda229771de4795b13a9826a524a01d433bfecc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Queiroz?= Date: Sat, 17 Jul 2021 00:12:07 -0300 Subject: [PATCH 3/6] fix log error message --- intg/src/main/python/apache_ranger/client/ranger_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intg/src/main/python/apache_ranger/client/ranger_client.py b/intg/src/main/python/apache_ranger/client/ranger_client.py index 25790dd47e..7b7888ae70 100644 --- a/intg/src/main/python/apache_ranger/client/ranger_client.py +++ b/intg/src/main/python/apache_ranger/client/ranger_client.py @@ -325,7 +325,7 @@ def __call_api(self, api, query_params=None, request_data=None): ret = None elif response.status_code == HTTPStatus.SERVICE_NOT_FOUND: - LOG.error("Ranger service not found. HTTP Status: %s", HTTPStatus.SERVICE_UNAVAILABLE) + LOG.error("Ranger service not found. HTTP Status: %s", HTTPStatus.SERVICE_NOT_FOUND) ret = None From 7b5ca8a045d7a83dd7208947bd4b6d08de211eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Queiroz?= Date: Fri, 23 Jul 2021 19:09:39 -0300 Subject: [PATCH 4/6] update http status name --- intg/src/main/python/apache_ranger/client/ranger_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/intg/src/main/python/apache_ranger/client/ranger_client.py b/intg/src/main/python/apache_ranger/client/ranger_client.py index 7b7888ae70..966dacca3b 100644 --- a/intg/src/main/python/apache_ranger/client/ranger_client.py +++ b/intg/src/main/python/apache_ranger/client/ranger_client.py @@ -324,8 +324,8 @@ def __call_api(self, api, query_params=None, request_data=None): LOG.error("Ranger admin unavailable. HTTP Status: %s", HTTPStatus.SERVICE_UNAVAILABLE) ret = None - elif response.status_code == HTTPStatus.SERVICE_NOT_FOUND: - LOG.error("Ranger service not found. HTTP Status: %s", HTTPStatus.SERVICE_NOT_FOUND) + elif response.status_code == HTTPStatus.NOT_FOUND: + LOG.error("Not found. HTTP Status: %s", HTTPStatus.NOT_FOUND) ret = None From 368d25162623acd87a3d1876a63be523c545372c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Queiroz?= Date: Fri, 23 Jul 2021 19:10:06 -0300 Subject: [PATCH 5/6] update http status name --- intg/src/main/python/apache_ranger/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intg/src/main/python/apache_ranger/utils.py b/intg/src/main/python/apache_ranger/utils.py index 8695116680..24b531fa62 100644 --- a/intg/src/main/python/apache_ranger/utils.py +++ b/intg/src/main/python/apache_ranger/utils.py @@ -89,6 +89,6 @@ class HttpMethod(enum.Enum): class HTTPStatus: OK = 200 NO_CONTENT = 204 - SERVICE_NOT_FOUND = 404 + NOT_FOUND = 404 INTERNAL_SERVER_ERROR = 500 SERVICE_UNAVAILABLE = 503 From 18c31a060e8227625e823eb51567a2659dab633c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Queiroz?= Date: Fri, 23 Jul 2021 19:10:36 -0300 Subject: [PATCH 6/6] add spaces --- intg/src/main/python/apache_ranger/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intg/src/main/python/apache_ranger/utils.py b/intg/src/main/python/apache_ranger/utils.py index 24b531fa62..b0ceb5c59d 100644 --- a/intg/src/main/python/apache_ranger/utils.py +++ b/intg/src/main/python/apache_ranger/utils.py @@ -89,6 +89,6 @@ class HttpMethod(enum.Enum): class HTTPStatus: OK = 200 NO_CONTENT = 204 - NOT_FOUND = 404 + NOT_FOUND = 404 INTERNAL_SERVER_ERROR = 500 SERVICE_UNAVAILABLE = 503