You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by si...@apache.org on 2022/06/28 18:09:46 UTC

[ozone] branch master updated: HDDS-6948. MultiTenantAccessAuthorizerRangerPlugin#deletePolicyByName should log and exit if getAccessPolicyByName returns null (#3551)

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

siyao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new f7bd665bac HDDS-6948. MultiTenantAccessAuthorizerRangerPlugin#deletePolicyByName should log and exit if getAccessPolicyByName returns null (#3551)
f7bd665bac is described below

commit f7bd665bac2a68f98bf3fb004edf278db20ef9fa
Author: George Huang <j....@cloudera.com>
AuthorDate: Tue Jun 28 11:09:42 2022 -0700

    HDDS-6948. MultiTenantAccessAuthorizerRangerPlugin#deletePolicyByName should log and exit if getAccessPolicyByName returns null (#3551)
---
 .../multitenant/MultiTenantAccessAuthorizerRangerPlugin.java   | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/MultiTenantAccessAuthorizerRangerPlugin.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/MultiTenantAccessAuthorizerRangerPlugin.java
index 0ac783f02d..8a33b87e16 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/MultiTenantAccessAuthorizerRangerPlugin.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/MultiTenantAccessAuthorizerRangerPlugin.java
@@ -733,9 +733,13 @@ public class MultiTenantAccessAuthorizerRangerPlugin implements
   @Override
   public void deletePolicyByName(String policyName) throws IOException {
     AccessPolicy policy = getAccessPolicyByName(policyName);
-    String policyID = policy.getPolicyID();
-    LOG.debug("policyID is: {}", policyID);
-    deletePolicyById(policyID);
+    if (policy != null) {
+      String policyID = policy.getPolicyID();
+      LOG.debug("policyID is: {}", policyID);
+      deletePolicyById(policyID);
+    } else {
+      LOG.error("No such policy: {} was found!", policyName);
+    }
   }
 
   public void deletePolicyById(String policyId) throws IOException {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org