You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ab...@apache.org on 2020/04/01 22:32:28 UTC

[ranger] branch master updated: RANGER-2773: Enhanced logging messages for RangerScriptConditionEvaluator class

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

abhay 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 eafe72e  RANGER-2773: Enhanced logging messages for RangerScriptConditionEvaluator class
eafe72e is described below

commit eafe72eb10fc165e865f3a8a43663e457e1ab96e
Author: Abhay Kulkarni <ab...@apache.org>
AuthorDate: Wed Apr 1 15:31:32 2020 -0700

    RANGER-2773: Enhanced logging messages for RangerScriptConditionEvaluator class
---
 .../conditionevaluator/RangerScriptConditionEvaluator.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java b/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java
index 5b66539..8da42ba 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java
@@ -72,6 +72,11 @@ public class RangerScriptConditionEvaluator extends RangerAbstractConditionEvalu
 			LOG.error("RangerScriptConditionEvaluator.init() failed with exception=" + exp);
 		}
 
+		if (scriptEngine == null) {
+			String conditionType = condition != null ? condition.getType() : null;
+			LOG.error("failed to initialize condition '" + conditionType + "': script engine '" + engineName + "' was not created");
+		}
+
 		if (LOG.isDebugEnabled()) {
 			LOG.debug("<== RangerScriptConditionEvaluator.init(" + condition + ")");
 		}
@@ -123,8 +128,14 @@ public class RangerScriptConditionEvaluator extends RangerAbstractConditionEvalu
 					LOG.error("RangerScriptConditionEvaluator.isMatched(): failed to evaluate script," +
 							" exception=" + exception);
 				}
+			} else {
+				String conditionType = condition != null ? condition.getType() : null;
+				LOG.error("failed to evaluate condition '" + conditionType + "': script is empty");
 			}
 
+		} else {
+			String conditionType = condition != null ? condition.getType() : null;
+			LOG.error("failed to evaluate condition '" + conditionType + "': script engine not found");
 		}
 
 		if (LOG.isDebugEnabled()) {