resources: Polish the password PoC and build out send/recv

This polishes the password resource so that it can actually avoid
writing the password to disk, and so that the work actually happens in
CheckApply where it can properly interact with the graph. This resource
now re-generates the password when it receives a notification.

The send/recv plumbing has been extended so that receivers can detect
when they're receiving new values. This is particularly important if
they might otherwise not expect those values to change and cache them
for efficiency purposes.
This commit is contained in:
James Shubin
2016-12-06 02:25:34 -05:00
parent 2b47d7494e
commit 597ed6eaa0
9 changed files with 225 additions and 107 deletions

View File

@@ -174,9 +174,9 @@ func (g *Graph) Process(v *Vertex) error {
obj.SetState(resources.ResStateCheckApply)
// connect any senders to receivers and detect if values changed
if changed, err := obj.SendRecv(obj); err != nil {
if updated, err := obj.SendRecv(obj); err != nil {
return errwrap.Wrapf(err, "could not SendRecv in Process")
} else if changed {
} else if len(updated) > 0 {
obj.StateOK(false) // invalidate cache, mark as dirty
}