Skip to content

Commit

Permalink
Fix issue where the number of machines in the config yaml would be ov…
Browse files Browse the repository at this point in the history
…erwritten
  • Loading branch information
mhmdiaa committed Feb 23, 2024
1 parent f392d62 commit 3878eff
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions cmd/execute/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,33 +87,35 @@ var ExecuteCmd = &cobra.Command{

allNodes, roots = CreateTrees(version, false)

if maxMachines {
executionMachines = version.MaxMachines
} else if machineConfiguration != "" {
machines, err := parseMachineConfiguration(machineConfiguration)
if err != nil {
fmt.Printf("Error: %s\n", err)
os.Exit(1)
}

if len(fleet.Machines) == 3 {
// 3 types of machines: small, medium, and large
executionMachines = machines

if machines.Default != nil {
fmt.Printf("Error: you need to use the small-medium-large format to specify the numbers of machines (e.g. 1-2-3)")
os.Exit(1)
}
} else {
// 1 type of machine
executionMachines, err = handleSingleMachineType(*fleet, machines)
if executionMachines == (types.Machines{}) {
if maxMachines {
executionMachines = version.MaxMachines
} else if machineConfiguration != "" {
machines, err := parseMachineConfiguration(machineConfiguration)
if err != nil {
fmt.Printf("Error: %s\n", err)
os.Exit(1)
}

if len(fleet.Machines) == 3 {
// 3 types of machines: small, medium, and large
executionMachines = machines

if machines.Default != nil {
fmt.Printf("Error: you need to use the small-medium-large format to specify the numbers of machines (e.g. 1-2-3)")
os.Exit(1)
}
} else {
// 1 type of machine
executionMachines, err = handleSingleMachineType(*fleet, machines)
if err != nil {
fmt.Printf("Error: %s\n", err)
os.Exit(1)
}
}
} else {
executionMachines = setMachinesToMinimum(version.MaxMachines)
}
} else {
executionMachines = setMachinesToMinimum(version.MaxMachines)
}

outputNodes := make([]string, 0)
Expand Down

0 comments on commit 3878eff

Please sign in to comment.