ranger-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Madhan Neethiraj <mad...@apache.org>
Subject Re: Review Request 66245: Ranger Kafka default policy creation improvement
Date Mon, 02 Apr 2018 17:20:27 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66245/#review200295
-----------------------------------------------------------




agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBaseService.java
Lines 136 (patched)
<https://reviews.apache.org/r/66245/#comment280985>

    Hardcoding max of "3" policies doesn't look right. Instead, I would suggest to retrieve
all defined indexes by scanning the configs - as shown below:
    
    if (additionalDefaultPolicySetup) {
      final String PROP_POLICY_NAME_PREFIX = "policy.";
      final String PROP_POLICY_NAME_SUFFIX = ".name";
    
      List<String> policyIndexes = new ArrayList<>();
    
      for (String configName : configs.keySet()) {
        if (configName.startsWith(PROP_POLICY_NAME_PREFIX) && configName.endsWith(PROP_POLICY_NAME_SUFFIX))
{
          policyIndexes.add(configName.substring(PROP_POLICY_NAME_PREFIX.length(), configName.length()
- PROP_POLICY_NAME_SUFFIX.length());
        }
      }
    
      for (String policyIndex : policyIndexes) {
        String                            propertyPrefix  = "policy." + policyIndex + ".resource.";
        Map<String, RangerPolicyResource> policyResources = getResourcesForPrefix(resourcePropertyPrefix);
    
    	if (MapUtils.isNotEmpty(policyResources()){
          // ...
        }
      }
    }


- Madhan Neethiraj


On April 2, 2018, 9:04 a.m., Nikhil P wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/66245/
> -----------------------------------------------------------
> 
> (Updated April 2, 2018, 9:04 a.m.)
> 
> 
> Review request for ranger, Ankita Sinha, Don Bosco Durai, Gautam Borad, Abhay Kulkarni,
Madhan Neethiraj, Pradeep Agrawal, Ramesh Mani, Selvamohan Neethiraj, Sailaja Polavarapu,
and Velmurugan Periasamy.
> 
> 
> Bugs: RANGER-2029
>     https://issues.apache.org/jira/browse/RANGER-2029
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> Ranger Kafka default policy creation improvement.
> 
> 
> Diffs
> -----
> 
>   agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBaseService.java
d99f478 
>   plugin-kafka/src/main/java/org/apache/ranger/services/kafka/RangerServiceKafka.java
b7bbe98 
> 
> 
> Diff: https://reviews.apache.org/r/66245/diff/2/
> 
> 
> Testing
> -------
> 
> 1) Tested if required policies are getting created when required service configs are
given.
> 
> 
> Thanks,
> 
> Nikhil P
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message