Skip to content

Commit

Permalink
Rename inline method as per review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
sayboras committed May 13, 2020
1 parent 74aa33c commit c2cd88d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cfn/manager/nodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (c *StackCollection) ScaleNodeGroup(ng *api.NodeGroup) error {
}

// Set the new values
maybeUpdateField := func(path, fieldName string, newVal *int, oldVal gjson.Result) error {
updateField := func(path, fieldName string, newVal *int, oldVal gjson.Result) error {
if !hasChanged(newVal, oldVal) {
return nil
}
Expand All @@ -223,15 +223,15 @@ func (c *StackCollection) ScaleNodeGroup(ng *api.NodeGroup) error {
return nil
}

if err := maybeUpdateField(desiredCapacityPath, "desired capacity", ng.DesiredCapacity, currentCapacity); err != nil {
if err := updateField(desiredCapacityPath, "desired capacity", ng.DesiredCapacity, currentCapacity); err != nil {
return err
}

if err := maybeUpdateField(minSizePath, "min size", ng.MinSize, currentMinSize); err != nil {
if err := updateField(minSizePath, "min size", ng.MinSize, currentMinSize); err != nil {
return err
}

if err := maybeUpdateField(maxSizePath, "max size", ng.MaxSize, currentMaxSize); err != nil {
if err := updateField(maxSizePath, "max size", ng.MaxSize, currentMaxSize); err != nil {
return err
}
logger.Debug("stack template (post-scale change): %s", template)
Expand Down

0 comments on commit c2cd88d

Please sign in to comment.