Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(459)

Delta Between Two Patch Sets: cmd/jujud/machine.go

Issue 25040043: Refactor container provisioner (Closed)
Left Patch Set: - Created 10 years, 4 months ago
Right Patch Set: - Created 10 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 // Copyright 2012, 2013 Canonical Ltd. 1 // Copyright 2012, 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package main 4 package main
5 5
6 import ( 6 import (
7 "fmt" 7 "fmt"
8 "os" 8 "os"
9 "path/filepath" 9 "path/filepath"
10 "time" 10 "time"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // and a suitable provisioner is started. 227 // and a suitable provisioner is started.
228 func (a *MachineAgent) updateSupportedContainers(runner worker.Runner, st *api.S tate, 228 func (a *MachineAgent) updateSupportedContainers(runner worker.Runner, st *api.S tate,
229 tag string, containers []instance.ContainerType) error { 229 tag string, containers []instance.ContainerType) error {
230 230
231 var machine *apiprovisioner.Machine 231 var machine *apiprovisioner.Machine
232 var err error 232 var err error
233 pr := st.Provisioner() 233 pr := st.Provisioner()
234 if machine, err = pr.Machine(tag); err != nil { 234 if machine, err = pr.Machine(tag); err != nil {
235 return fmt.Errorf("%s is not in state: %v", tag, err) 235 return fmt.Errorf("%s is not in state: %v", tag, err)
236 } 236 }
237 » if err := machine.AddSupportedContainers(containers); err != nil { 237 » if err := machine.AddSupportedContainers(containers...); err != nil {
william.reade 2013/11/18 15:30:58 This does look to me more like we're setting the f
238 return fmt.Errorf("adding supported containers to %s: %v", tag, err) 238 return fmt.Errorf("adding supported containers to %s: %v", tag, err)
239 } 239 }
240 // Start the watcher to fire when a container is first requested on the machine. 240 // Start the watcher to fire when a container is first requested on the machine.
241 for _, ctype := range containers { 241 for _, ctype := range containers {
242 watcherName := fmt.Sprintf("%s-watcher", ctype) 242 watcherName := fmt.Sprintf("%s-watcher", ctype)
243 handler := provisioner.NewContainerSetupHandler(runner, watcherN ame, ctype, machine, pr, a.Conf.config) 243 handler := provisioner.NewContainerSetupHandler(runner, watcherN ame, ctype, machine, pr, a.Conf.config)
244 runner.StartWorker(watcherName, func() (worker.Worker, error) { 244 runner.StartWorker(watcherName, func() (worker.Worker, error) {
245 return worker.NewStringsWorker(handler), nil 245 return worker.NewStringsWorker(handler), nil
246 }) 246 })
247 } 247 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 select { 371 select {
372 case apiReporter <- st: 372 case apiReporter <- st:
373 default: 373 default:
374 } 374 }
375 } 375 }
376 func sendOpenedAPIs(dst chan<- *api.State) (undo func()) { 376 func sendOpenedAPIs(dst chan<- *api.State) (undo func()) {
377 var original chan<- *api.State 377 var original chan<- *api.State
378 original, apiReporter = apiReporter, dst 378 original, apiReporter = apiReporter, dst
379 return func() { apiReporter = original } 379 return func() { apiReporter = original }
380 } 380 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b