You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by co...@apache.org on 2015/08/26 07:54:59 UTC

incubator-sentry git commit: SENTRY-739: when user doesn't have admin privileges, show grant throw exception, better improve error message (Colin Ma, Reviewed by: Anne Yu)

Repository: incubator-sentry
Updated Branches:
  refs/heads/master d8063f5ef -> 0a93259cb


SENTRY-739: when user doesn't have admin privileges, show grant throw exception, better improve error message (Colin Ma, Reviewed by: Anne Yu)


Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/0a93259c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/0a93259c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/0a93259c

Branch: refs/heads/master
Commit: 0a93259cb738a0b256100e769c3f0426dac2b623
Parents: d8063f5
Author: Colin Ma <co...@apache.org>
Authored: Wed Aug 26 13:30:14 2015 +0800
Committer: Colin Ma <co...@apache.org>
Committed: Wed Aug 26 13:30:14 2015 +0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0a93259c/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java
index 13c2c58..1e2b3b9 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java
@@ -165,7 +165,10 @@ public class SentryGrantRevokeTask extends Task<DDLWork> implements Serializable
       }
     } catch(SentryUserException e) {
       setException(new Exception(e.getClass().getSimpleName() + ": " + e.getReason(), e));
-      String msg = "Error processing Sentry command: " + e.getMessage();
+      String msg = "Error processing Sentry command: " + e.getReason() + ".";
+      if (e instanceof SentryAccessDeniedException) {
+        msg += "Please grant admin privilege to " + subject.getName() + ".";
+      }
       LOG.error(msg, e);
       console.printError(msg);
       return RETURN_CODE_FAILURE;