Beispiel #1
0
func newDeployer(st *state.State, w *state.UnitsWatcher, dataDir string) *deployer.Deployer {
	info := &state.Info{
		EntityName: w.EntityName(),
		Addrs:      st.Addrs(),
		CACert:     st.CACert(),
	}
	mgr := newDeployManager(st, info, dataDir)
	return deployer.NewDeployer(st, mgr, w)
}
Beispiel #2
0
// NewDeployer returns a Deployer that deploys and recalls unit agents via
// mgr, according to membership and lifecycle changes notified by w.
func NewDeployer(st *state.State, mgr Manager, w *state.UnitsWatcher) *Deployer {
	d := &Deployer{
		st:         st,
		mgr:        mgr,
		entityName: w.EntityName(),
		deployed:   map[string]bool{},
	}
	go func() {
		defer d.tomb.Done()
		defer watcher.Stop(w, &d.tomb)
		d.tomb.Kill(d.loop(w))
	}()
	return d
}