fix: skip policy usage validation for cache update (#19008)

When updating the policy cache, we do not need to validate policy usage
as the policy has already been deleted by the node sending the
notification.
This commit is contained in:
Aditya Manthramurthy
2024-02-07 20:39:53 -08:00
committed by GitHub
parent 7e082f232e
commit e104b183d8
2 changed files with 42 additions and 35 deletions

View File

@@ -526,7 +526,9 @@ func (sys *IAMSys) GetRolePolicy(arnStr string) (arn.ARN, string, error) {
return roleArn, rolePolicy, nil
}
// DeletePolicy - deletes a canned policy from backend or etcd.
// DeletePolicy - deletes a canned policy from backend. `notifyPeers` is true
// whenever this is called via the API. It is false when called via a
// notification from another peer. This is to avoid infinite loops.
func (sys *IAMSys) DeletePolicy(ctx context.Context, policyName string, notifyPeers bool) error {
if !sys.Initialized() {
return errServerNotInitialized
@@ -540,7 +542,7 @@ func (sys *IAMSys) DeletePolicy(ctx context.Context, policyName string, notifyPe
}
}
err := sys.store.DeletePolicy(ctx, policyName)
err := sys.store.DeletePolicy(ctx, policyName, !notifyPeers)
if err != nil {
return err
}