jerqi commented on code in PR #6515:
URL: https://github.com/apache/gravitino/pull/6515#discussion_r1972747410


##########
authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerHelper.java:
##########
@@ -278,9 +278,18 @@ protected RangerRole createRangerRoleIfNotExists(String 
roleName, boolean isOwne
     try {
       rangerRole = rangerClient.getRole(roleName, rangerAdminName, 
rangerServiceName);
     } catch (RangerServiceException e) {
-      // ignore exception, If the role does not exist, then create it.
-      LOG.warn("The role({}) does not exist in the Ranger!", roleName);
+
+      // The client will return a error message contains `doesn't have 
permission` if the role does
+      // not exist, then create it.
+      if (e.getMessage().contains("User doesn't have permissions to get 
details")) {
+        LOG.warn("The role({}) does not exist in the Ranger!, e: {}", 
roleName, e);

Review Comment:
   I have no better way to check this. Do you have suggestion?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to