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

madhan pushed a commit to branch ranger-2.6
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/ranger-2.6 by this push:
     new 9b7ed269c RANGER-5103: RangerPluginConfig to support initialization 
with additional config files (#510)
9b7ed269c is described below

commit 9b7ed269c95902e2e00d2694ad82751c3e1a881b
Author: Madhan Neethiraj <[email protected]>
AuthorDate: Mon Jan 13 19:06:20 2025 -0800

    RANGER-5103: RangerPluginConfig to support initialization with additional 
config files (#510)
    
    (cherry picked from commit e31eeb3fd5c53a214cd9458e3358ee277672cf61)
---
 .../authorization/hadoop/config/RangerPluginConfig.java   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git 
a/agents-common/src/main/java/org/apache/ranger/authorization/hadoop/config/RangerPluginConfig.java
 
b/agents-common/src/main/java/org/apache/ranger/authorization/hadoop/config/RangerPluginConfig.java
index df6307eb2..e4dd64dda 100644
--- 
a/agents-common/src/main/java/org/apache/ranger/authorization/hadoop/config/RangerPluginConfig.java
+++ 
b/agents-common/src/main/java/org/apache/ranger/authorization/hadoop/config/RangerPluginConfig.java
@@ -31,6 +31,7 @@ import java.io.File;
 import java.net.URL;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 
@@ -62,6 +63,10 @@ public class RangerPluginConfig extends RangerConfiguration {
 
 
     public RangerPluginConfig(String serviceType, String serviceName, String 
appId, String clusterName, String clusterType, RangerPolicyEngineOptions 
policyEngineOptions) {
+        this(serviceType, serviceName, appId, clusterName, clusterType, null, 
policyEngineOptions);
+    }
+
+    public RangerPluginConfig(String serviceType, String serviceName, String 
appId, String clusterName, String clusterType, List<File> 
additionalConfigFiles, RangerPolicyEngineOptions policyEngineOptions) {
         super();
 
         addResourcesForServiceType(serviceType);
@@ -73,6 +78,16 @@ public class RangerPluginConfig extends RangerConfiguration {
 
         addResourcesForServiceName(this.serviceType, this.serviceName);
 
+        if (additionalConfigFiles != null) {
+            for (File configFile : additionalConfigFiles) {
+                try {
+                    addResource(configFile.toURI().toURL());
+                } catch (Throwable t) {
+                    LOG.warn("failed to load configurations from {}", 
configFile, t);
+                }
+            }
+        }
+
         String trustedProxyAddressString = this.get(propertyPrefix + 
".trusted.proxy.ipaddresses");
 
         if (StringUtil.isEmpty(clusterName)) {

Reply via email to