Skip to content

Commit

Permalink
Merge pull request #200 from kanisterio/efs-set-tag-fix
Browse files Browse the repository at this point in the history
This PR adds a guard against empty tags.

AWS methods give error when an empty or empty content map are passed to tag-setting methods.
To fix this problem, we need to check the size of the map before passing the maps.

* Adds a size check for setBackupTags.
* Adds a size check for setEFSTags.
  • Loading branch information
Hakan Memisoglu committed Aug 13, 2019
2 parents 4752482 + 8172628 commit b28b459
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/blockstorage/awsefs/awsefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ func (e *efs) SetTags(ctx context.Context, resource interface{}, tags map[string
}

func (e *efs) setBackupTags(ctx context.Context, arn string, tags map[string]string) error {
if len(tags) == 0 {
return nil
}
req := &backup.TagResourceInput{
ResourceArn: &arn,
Tags: convertToBackupTags(tags),
Expand All @@ -399,6 +402,9 @@ func (e *efs) setBackupTags(ctx context.Context, arn string, tags map[string]str
}

func (e *efs) setEFSTags(ctx context.Context, id string, tags map[string]string) error {
if len(tags) == 0 {
return nil
}
req := &awsefs.CreateTagsInput{
FileSystemId: &id,
Tags: convertToEFSTags(tags),
Expand Down

0 comments on commit b28b459

Please sign in to comment.