Restore buildTags in createTags

This commit is contained in:
Maxim Ivanov 2017-05-02 06:32:52 +01:00
parent 54203aaa9e
commit 9ef85a7e6d

View File

@ -174,6 +174,10 @@ func (c *awsTagging) readRepairClusterTags(client EC2, resourceID string, lifecy
} }
} }
if len(addTags) == 0 {
return nil
}
if err := c.createTags(client, resourceID, lifecycle, addTags); 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,7 +188,9 @@ 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, tags map[string]string) error { func (t *awsTagging) createTags(client EC2, resourceID string, lifecycle ResourceLifecycle, additionalTags 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
} }