From 2a0721bddf754e37ee3edfa6a9eb0bd9eaf87e91 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Wed, 31 Aug 2016 22:38:56 -0400 Subject: [PATCH] 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. --- remote.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/remote.go b/remote.go index c291269c..1c913bd1 100644 --- a/remote.go +++ b/remote.go @@ -964,6 +964,8 @@ func (obj *Remotes) Run() { } // ignore errors } }() + } else { + obj.cuuid.SetConverged(true) // if no watches, we're converged! } // the semaphore provides the max simultaneous connection limit @@ -978,6 +980,10 @@ func (obj *Remotes) Run() { sshobj, err := obj.NewSSH(f) if err != nil { 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 } obj.sshmap[f] = sshobj // save a reference