Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RANGER-3370: Python ranger_client call_api - add case for 404 response #110

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions intg/src/main/python/apache_ranger/client/ranger_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming SERVICE_NOT_FOUND => NOT_FOUND.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the comments @mneethiraj, it makes sense

LOG.error("Ranger service not found. HTTP Status: %s", HTTPStatus.SERVICE_NOT_FOUND)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Ranger service not found" => "Not found"


ret = None

else:
raise RangerServiceException(api, response)

Expand Down
1 change: 1 addition & 0 deletions intg/src/main/python/apache_ranger/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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