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

Unified Diff: worker/firewaller/firewaller.go

Issue 13552046: worker: Use WatchForEnvironConfigChanges() (Closed)
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « worker/environ.go ('k') | worker/provisioner/provisioner.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: worker/firewaller/firewaller.go
=== modified file 'worker/firewaller/firewaller.go'
--- worker/firewaller/firewaller.go 2013-09-13 14:48:13 +0000
+++ worker/firewaller/firewaller.go 2013-09-18 10:53:54 +0000
@@ -24,7 +24,7 @@
tomb tomb.Tomb
st *state.State
environ environs.Environ
- environWatcher *state.EnvironConfigWatcher
+ environWatcher state.NotifyWatcher
machinesWatcher state.StringsWatcher
machineds map[string]*machineData
unitsChange chan *unitsChange
@@ -40,7 +40,7 @@
func NewFirewaller(st *state.State) *Firewaller {
fw := &Firewaller{
st: st,
- environWatcher: st.WatchEnvironConfig(),
+ environWatcher: st.WatchForEnvironConfigChanges(),
machinesWatcher: st.WatchEnvironMachines(),
machineds: make(map[string]*machineData),
unitsChange: make(chan *unitsChange),
@@ -62,7 +62,7 @@
var err error
var reconciled bool
- fw.environ, err = worker.WaitForEnviron(fw.environWatcher, fw.tomb.Dying())
+ fw.environ, err = worker.WaitForEnviron(fw.environWatcher, fw.st, fw.tomb.Dying())
if err != nil {
return err
}
@@ -74,11 +74,15 @@
select {
case <-fw.tomb.Dying():
return tomb.ErrDying
- case change, ok := <-fw.environWatcher.Changes():
+ case _, ok := <-fw.environWatcher.Changes():
if !ok {
return watcher.MustErr(fw.environWatcher)
}
- if err := fw.environ.SetConfig(change); err != nil {
+ config, err := fw.st.EnvironConfig()
+ if err != nil {
+ return err
+ }
+ if err := fw.environ.SetConfig(config); err != nil {
log.Errorf("worker/firewaller: loaded invalid environment configuration: %v", err)
}
case change, ok := <-fw.machinesWatcher.Changes():
« no previous file with comments | « worker/environ.go ('k') | worker/provisioner/provisioner.go » ('j') | no next file with comments »

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