// startProvisionerWorker kicks off a provisioner task responsible for creating containers // of the specified type on the machine. func startProvisionerWorker(runner worker.Runner, containerType instance.ContainerType, provisioner *apiprovisioner.State, config agent.Config, broker environs.InstanceBroker) error { workerName := fmt.Sprintf("%s-provisioner", containerType) // The provisioner task is created after a container record has already been added to the machine. // It will see that the container does not have an instance yet and create one. return runner.StartWorker(workerName, func() (worker.Worker, error) { return NewContainerProvisioner(containerType, provisioner, config, broker), nil }) }
// startProvisionerWorker kicks off a provisioner task responsible for creating containers // of the specified type on the machine. func startProvisionerWorker( runner worker.Runner, containerType instance.ContainerType, provisioner *apiprovisioner.State, config agent.Config, broker environs.InstanceBroker, toolsFinder ToolsFinder, ) error { workerName := fmt.Sprintf("%s-provisioner", containerType) // The provisioner task is created after a container record has // already been added to the machine. It will see that the // container does not have an instance yet and create one. return runner.StartWorker(workerName, func() (worker.Worker, error) { w, err := NewContainerProvisioner(containerType, provisioner, config, broker, toolsFinder) if err != nil { return nil, errors.Trace(err) } return w, nil }) }
// startWorkerAfterUpgrade starts a worker to run the specified child worker // but only after waiting for upgrades to complete. func (a *MachineAgent) startWorkerAfterUpgrade(runner worker.Runner, name string, start func() (worker.Worker, error)) { runner.StartWorker(name, func() (worker.Worker, error) { return a.upgradeWaiterWorker(name, start), nil }) }