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/02/11 21:13:30 UTC
[ranger] branch master updated: RANGER-2722:
policies/hive/for-resource api call is returning deleted policies - part 2
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 e9959c0 RANGER-2722: policies/hive/for-resource api call is returning deleted policies - part 2
e9959c0 is described below
commit e9959c0c0b41684eace583cb3a68afa5ee97d7c5
Author: Abhay Kulkarni <ab...@apache.org>
AuthorDate: Tue Feb 11 12:58:22 2020 -0800
RANGER-2722: policies/hive/for-resource api call is returning deleted policies - part 2
---
.../org/apache/ranger/plugin/service/RangerBasePlugin.java | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java b/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java
index 75fbd64..32fbb06 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java
@@ -176,7 +176,6 @@ public class RangerBasePlugin {
ServicePolicies servicePolicies = null;
boolean isValid = true;
boolean usePolicyDeltas = false;
- boolean updateRolesOnly = false;
if (policies == null) {
policies = getDefaultSvcPolicies();
@@ -189,12 +188,7 @@ public class RangerBasePlugin {
Boolean hasPolicyDeltas = RangerPolicyDeltaUtil.hasPolicyDeltas(policies);
if (hasPolicyDeltas == null) {
- if (roles != null) {
- updateRolesOnly = true;
- } else {
- LOG.error("Policies, policy-deltas and roles are all null, Should not get here!!");
- isValid = false;
- }
+ LOG.warn("Policies and policy-deltas are empty. Creating policy engine with no policies!!");
} else {
if (hasPolicyDeltas.equals(Boolean.TRUE)) {
// Rebuild policies from deltas
@@ -218,11 +212,9 @@ public class RangerBasePlugin {
RangerPolicyEngine newPolicyEngine = null;
boolean isPolicyEngineShared = false;
- if (updateRolesOnly) {
- this.policyEngine.setRoles(roles);
- } else if (!usePolicyDeltas) {
+ if (!usePolicyDeltas) {
if (LOG.isDebugEnabled()) {
- LOG.debug("policies are not null. Creating engine from policies");
+ LOG.debug("Creating engine from policies");
}
newPolicyEngine = new RangerPolicyEngineImpl(policies, pluginContext, roles);