mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
Disallow deletion of ARN when under active replication (#14972)
fixes a regression from #12880
This commit is contained in:
parent
41cdb357bb
commit
d8101573be
@ -201,7 +201,7 @@ func (sys *BucketTargetSys) RemoveTarget(ctx context.Context, bucket, arnStr str
|
|||||||
// reject removal of remote target if replication configuration is present
|
// reject removal of remote target if replication configuration is present
|
||||||
rcfg, err := getReplicationConfig(ctx, bucket)
|
rcfg, err := getReplicationConfig(ctx, bucket)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
for _, tgtArn := range rcfg.FilterTargetArns(replication.ObjectOpts{}) {
|
for _, tgtArn := range rcfg.FilterTargetArns(replication.ObjectOpts{OpType: replication.AllReplicationType}) {
|
||||||
if err == nil && (tgtArn == arnStr || rcfg.RoleArn == arnStr) {
|
if err == nil && (tgtArn == arnStr || rcfg.RoleArn == arnStr) {
|
||||||
sys.RLock()
|
sys.RLock()
|
||||||
_, ok := sys.arnRemotesMap[arnStr]
|
_, ok := sys.arnRemotesMap[arnStr]
|
||||||
|
@ -124,6 +124,7 @@ const (
|
|||||||
HealReplicationType
|
HealReplicationType
|
||||||
ExistingObjectReplicationType
|
ExistingObjectReplicationType
|
||||||
ResyncReplicationType
|
ResyncReplicationType
|
||||||
|
AllReplicationType
|
||||||
)
|
)
|
||||||
|
|
||||||
// Valid returns true if replication type is set
|
// Valid returns true if replication type is set
|
||||||
@ -148,7 +149,7 @@ type ObjectOpts struct {
|
|||||||
// FilterActionableRules returns the rules actions that need to be executed
|
// FilterActionableRules returns the rules actions that need to be executed
|
||||||
// after evaluating prefix/tag filtering
|
// after evaluating prefix/tag filtering
|
||||||
func (c Config) FilterActionableRules(obj ObjectOpts) []Rule {
|
func (c Config) FilterActionableRules(obj ObjectOpts) []Rule {
|
||||||
if obj.Name == "" && obj.OpType != ResyncReplicationType {
|
if obj.Name == "" && !(obj.OpType == ResyncReplicationType || obj.OpType == AllReplicationType) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var rules []Rule
|
var rules []Rule
|
||||||
@ -160,8 +161,8 @@ func (c Config) FilterActionableRules(obj ObjectOpts) []Rule {
|
|||||||
if obj.TargetArn != "" && rule.Destination.ARN != obj.TargetArn && c.RoleArn != obj.TargetArn {
|
if obj.TargetArn != "" && rule.Destination.ARN != obj.TargetArn && c.RoleArn != obj.TargetArn {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Ignore other object level and prefix filters for resyncing target
|
// Ignore other object level and prefix filters for resyncing target/listing bucket targets
|
||||||
if obj.OpType == ResyncReplicationType {
|
if obj.OpType == ResyncReplicationType || obj.OpType == AllReplicationType {
|
||||||
rules = append(rules, rule)
|
rules = append(rules, rule)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user