This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/master by this push:
     new bed66ec  RANGER-3370: updated Python client to handle 404 HTTPStatus 
code
bed66ec is described below

commit bed66ec23e5bb22126bb766f365eb660a30e2945
Author: Álvaro Queiroz <[email protected]>
AuthorDate: Fri Jul 16 23:56:26 2021 -0300

    RANGER-3370: updated Python client to handle 404 HTTPStatus code
    
    Signed-off-by: Madhan Neethiraj <[email protected]>
---
 intg/src/main/python/apache_ranger/client/ranger_client.py | 4 ++++
 intg/src/main/python/apache_ranger/utils.py                | 1 +
 2 files 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 4dfcfbc..ce6de34 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,10 @@ class RangerClient:
             LOG.error("Ranger admin unavailable. HTTP Status: %s", 
HTTPStatus.SERVICE_UNAVAILABLE)
 
             ret = None
+        elif response.status_code == HTTPStatus.NOT_FOUND:
+            LOG.error("Not found. HTTP Status: %s", HTTPStatus.NOT_FOUND)
+
+            ret = None
         else:
             raise RangerServiceException(api, response)
 
diff --git a/intg/src/main/python/apache_ranger/utils.py 
b/intg/src/main/python/apache_ranger/utils.py
index a564aaf..b0ceb5c 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
+    NOT_FOUND             = 404
     INTERNAL_SERVER_ERROR = 500
     SERVICE_UNAVAILABLE   = 503

Reply via email to