Commit 54203aaa authored by Maxim Ivanov's avatar Maxim Ivanov

fix AWS tagging to add missing tags only

It seems that intention of original code was to build map of missing tags and call AWS API to add just them, but due to typo full set of tags was always (re)added
parent ef4b4acf
...@@ -174,7 +174,7 @@ func (c *awsTagging) readRepairClusterTags(client EC2, resourceID string, lifecy ...@@ -174,7 +174,7 @@ func (c *awsTagging) readRepairClusterTags(client EC2, resourceID string, lifecy
} }
} }
if err := c.createTags(client, resourceID, lifecycle, additionalTags); err != nil { if err := c.createTags(client, resourceID, lifecycle, addTags); err != nil {
return fmt.Errorf("error adding missing tags to resource %q: %v", resourceID, err) return fmt.Errorf("error adding missing tags to resource %q: %v", resourceID, err)
} }
...@@ -184,9 +184,7 @@ func (c *awsTagging) readRepairClusterTags(client EC2, resourceID string, lifecy ...@@ -184,9 +184,7 @@ func (c *awsTagging) readRepairClusterTags(client EC2, resourceID string, lifecy
// createTags calls EC2 CreateTags, but adds retry-on-failure logic // createTags calls EC2 CreateTags, but adds retry-on-failure logic
// We retry mainly because if we create an object, we cannot tag it until it is "fully created" (eventual consistency) // We retry mainly because if we create an object, we cannot tag it until it is "fully created" (eventual consistency)
// The error code varies though (depending on what we are tagging), so we simply retry on all errors // The error code varies though (depending on what we are tagging), so we simply retry on all errors
func (t *awsTagging) createTags(client EC2, resourceID string, lifecycle ResourceLifecycle, additionalTags map[string]string) error { func (t *awsTagging) createTags(client EC2, resourceID string, lifecycle ResourceLifecycle, tags map[string]string) error {
tags := t.buildTags(lifecycle, additionalTags)
if tags == nil || len(tags) == 0 { if tags == nil || len(tags) == 0 {
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment