Skip to content
Snippets Groups Projects

Populate a list of machines with machines that might not yet be persisted on disk

All threads resolved!
Files
2
@@ -287,12 +287,14 @@ func (m *machineProvider) createMachines(config *common.RunnerConfig, data *mach
}
}
// intermediateMachineList returns a list of machines that might not yet be persisted on disk,
// these machines are the ones between being virtually created, and `docker-machine create` getting executed
// we populate this data set to overcome the race conditions related to not-full set of machines returned
// by `docker-machine ls -q`
func (m *machineProvider) intermediateMachineList(excludedMachines []string) (machines []string) {
// intermediateMachineList returns a list of machines that might not yet be
// persisted on disk, these machines are the ones between being virtually
// created, and `docker-machine create` getting executed we populate this data
// set to overcome the race conditions related to not-full set of machines
// returned by `docker-machine ls -q`
func (m *machineProvider) intermediateMachineList(excludedMachines []string) []string {
var excludedSet map[string]struct{}
var intermediateMachines []string
m.lock.Lock()
defer m.lock.Unlock()
@@ -304,7 +306,7 @@ func (m *machineProvider) intermediateMachineList(excludedMachines []string) (ma
// lazy init set, as most of times we don't create new machines
if excludedSet == nil {
excludedSet = make(map[string]struct{})
excludedSet = make(map[string]struct{}, len(excludedMachines))
for _, excludedMachine := range excludedMachines {
excludedSet[excludedMachine] = struct{}{}
}
@@ -314,10 +316,10 @@ func (m *machineProvider) intermediateMachineList(excludedMachines []string) (ma
continue
}
machines = append(machines, details.Name)
intermediateMachines = append(intermediateMachines, details.Name)
}
return
return intermediateMachines
}
func (m *machineProvider) loadMachines(config *common.RunnerConfig) (machines []string, err error) {
Loading