Skip to content

Commit

Permalink
Add snapshot retention folder fix
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Savian <vitor.savian@suse.com>
  • Loading branch information
vitorsavian committed Jun 4, 2024
1 parent 79ba10f commit 4cd1c27
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/etcd/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,12 @@ func (s *S3) deleteSnapshot(ctx context.Context, key string) error {
ctx, cancel := context.WithTimeout(ctx, s.config.EtcdS3Timeout)
defer cancel()

key = path.Join(s.config.EtcdS3Folder, key)
// verifys if the folder was added before the key to delete the snapshot
// since the retention can't delete the snapshot if has the s3 folder pre defined
if !strings.Contains(key, s.config.EtcdS3Folder+"/") {
key = path.Join(s.config.EtcdS3Folder, key)
}

err := s.client.RemoveObject(ctx, s.config.EtcdS3BucketName, key, minio.RemoveObjectOptions{})
if err == nil || isNotExist(err) {
metadataKey := path.Join(path.Dir(key), metadataDir, path.Base(key))
Expand Down

0 comments on commit 4cd1c27

Please sign in to comment.