resources: Simplify resource Converger and Startup code

This takes the Converged initialization and Startup patterns that are
common in all resources, and bakes it into the core engine. This way
resource writing is much more concise and there is less boilerplate!
This commit is contained in:
James Shubin
2016-12-11 22:22:53 -05:00
parent e519811893
commit 36b916f27f
14 changed files with 102 additions and 192 deletions

View File

@@ -415,7 +415,9 @@ func (g *Graph) Worker(v *Vertex) error {
}
// TODO: reset the watch retry count after some amount of success
v.Res.RegisterConverger()
e := v.Res.Watch(processChan)
v.Res.UnregisterConverger()
if e == nil { // exit signal
err = nil // clean exit
break