Skip to content

Commit

Permalink
Merge pull request #3863 from atlanhq/ns/feat/delta-policy-master
Browse files Browse the repository at this point in the history
PLT-2830 : Fix the stale policy in case of action updatae
  • Loading branch information
sumandas0 authored Dec 10, 2024
2 parents 52769ed + 6021ef3 commit 17d803e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static List<RangerPolicy> applyDeltas(List<RangerPolicy> policies, List<R
while (iter.hasNext()) {
RangerPolicy policy = iter.next();
if (
(changeType == RangerPolicyDelta.CHANGE_TYPE_POLICY_UPDATE && policyId.equals(policy.getGuid())) ||
(changeType == RangerPolicyDelta.CHANGE_TYPE_POLICY_UPDATE && policyId.equals(policy.getAtlasGuid())) ||
(changeType == RangerPolicyDelta.CHANGE_TYPE_POLICY_DELETE && policyId.equals(policy.getAtlasGuid()))
){
deletedPolicies.add(policy);
Expand All @@ -108,7 +108,7 @@ public static List<RangerPolicy> applyDeltas(List<RangerPolicy> policies, List<R
break;
}
case RangerPolicyDelta.CHANGE_TYPE_POLICY_UPDATE: {
if (CollectionUtils.isEmpty(deletedPolicies) || deletedPolicies.size() > 1) {
if (CollectionUtils.isEmpty(deletedPolicies)) {
LOG.warn("Unexpected: found no policy or multiple policies for CHANGE_TYPE_POLICY_UPDATE: " + Arrays.toString(deletedPolicies.toArray()));
}
break;
Expand Down

0 comments on commit 17d803e

Please sign in to comment.