Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
Make code mode concise
Browse files Browse the repository at this point in the history
  • Loading branch information
cw-kuoka committed May 13, 2016
1 parent 78e067f commit ea9f366
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions multi-node/aws/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ func (c Cluster) stackConfig(opts StackTemplateOptions, compressUserData bool) (
return nil, fmt.Errorf("invalid controllerIP: %s", stackConfig.ControllerIP)
}
controllerSubnetFound := false
lastSubnetIndex := len(stackConfig.Subnets) - 1
for i, subnet := range stackConfig.Subnets {
_, instanceCIDR, err := net.ParseCIDR(subnet.InstanceCIDR)
if err != nil {
Expand All @@ -242,10 +241,11 @@ func (c Cluster) stackConfig(opts StackTemplateOptions, compressUserData bool) (
if instanceCIDR.Contains(controllerIPAddr) {
stackConfig.ControllerSubnetIndex = i
controllerSubnetFound = true
} else if !controllerSubnetFound && i == lastSubnetIndex {
return nil, fmt.Errorf("Fail-fast occurred possibly because of a bug: ControllerSubnetIndex couldn't be determined for subnets (%v) and controllerIP (%v)", stackConfig.Subnets, stackConfig.ControllerIP)
}
}
if !controllerSubnetFound {
return nil, fmt.Errorf("Fail-fast occurred possibly because of a bug: ControllerSubnetIndex couldn't be determined for subnets (%v) and controllerIP (%v)", stackConfig.Subnets, stackConfig.ControllerIP)
}

if stackConfig.UserDataWorker, err = execute(opts.WorkerTmplFile, stackConfig.Config, compressUserData); err != nil {
return nil, fmt.Errorf("failed to render worker cloud config: %v", err)
Expand Down

0 comments on commit ea9f366

Please sign in to comment.