mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
Default DeleteReplication rule status if unspecified. (#15301)
Since this is a MinIO specific extension in the replication config, default this to Disabled to allow other sdks to be used to configure replication rules. Co-authored-by: Poorna Krishnamoorthy <poorna@minio.io>
This commit is contained in:
parent
bb4b143f3b
commit
53cc561048
@ -62,6 +62,12 @@ func ParseConfig(reader io.Reader) (*Config, error) {
|
||||
},
|
||||
}
|
||||
}
|
||||
// Default DeleteReplication to disabled if unset.
|
||||
if len(config.Rules[i].DeleteReplication.Status) == 0 {
|
||||
config.Rules[i].DeleteReplication = DeleteReplication{
|
||||
Status: Disabled,
|
||||
}
|
||||
}
|
||||
}
|
||||
return &config, nil
|
||||
}
|
||||
|
@ -38,13 +38,13 @@ func TestParseAndValidateReplicationConfig(t *testing.T) {
|
||||
expectedParsingErr: nil,
|
||||
expectedValidationErr: errInvalidDeleteMarkerReplicationStatus,
|
||||
},
|
||||
// 2 Invalid delete replication status in replication config
|
||||
// 2 No delete replication status in replication config
|
||||
{
|
||||
inputConfig: `<ReplicationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Role>arn:aws:iam::AcctID:role/role-name</Role><Rule><Status>Enabled</Status><DeleteMarkerReplication><Status>Disabled</Status></DeleteMarkerReplication><Prefix>key-prefix</Prefix><Destination><Bucket>arn:aws:s3:::destinationbucket</Bucket></Destination></Rule></ReplicationConfiguration>`,
|
||||
destBucket: "destinationbucket",
|
||||
sameTarget: false,
|
||||
expectedParsingErr: nil,
|
||||
expectedValidationErr: errDeleteReplicationMissing,
|
||||
expectedValidationErr: nil,
|
||||
},
|
||||
// 3 valid replication config
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user