Fix mislooping in ssh.go. Add retries to AddSSHKeys.

This commit is contained in:
CJ Cullen
2015-06-15 23:00:01 -07:00
parent a8269e38c9
commit 4d5d0457ef
2 changed files with 42 additions and 31 deletions

View File

@@ -223,11 +223,12 @@ func MakeSSHTunnels(user, keyfile string, addresses []string) (SSHTunnelList, er
}
func (l SSHTunnelList) Open() error {
for ix := range l {
for ix := 0; ix < len(l); ix++ {
if err := l[ix].Tunnel.Open(); err != nil {
// Remove a failed Open from the list.
glog.Errorf("Failed to open tunnel %v: %v", l[ix], err)
l = append(l[:ix], l[ix+1:]...)
ix--
}
}
if len(l) == 0 {