remote: allow converge during corner cases

This allows the system to converge during corner cases where there is an
error, or when there are no remotes being used, but we are using the
--no-watch variable.

I deliberately left this in as a separate commit instead of rebasing
into the remote execution development branch because the placement of
the Unregister() and semaphore.V(1) were quite subtle and easy to forget
about.
This commit is contained in:
James Shubin
2016-08-31 22:38:56 -04:00
parent ff01e4a5e7
commit 2a0721bddf

View File

@@ -964,6 +964,8 @@ func (obj *Remotes) Run() {
} // ignore errors } // ignore errors
} }
}() }()
} else {
obj.cuuid.SetConverged(true) // if no watches, we're converged!
} }
// the semaphore provides the max simultaneous connection limit // the semaphore provides the max simultaneous connection limit
@@ -978,6 +980,10 @@ func (obj *Remotes) Run() {
sshobj, err := obj.NewSSH(f) sshobj, err := obj.NewSSH(f)
if err != nil { if err != nil {
log.Printf("Remote: Error: %s", err) log.Printf("Remote: Error: %s", err)
if obj.cConns != 0 {
obj.semaphore.V(1) // don't lock the loop
}
obj.cuuids[f].Unregister() // don't stall the converge!
continue continue
} }
obj.sshmap[f] = sshobj // save a reference obj.sshmap[f] = sshobj // save a reference