Make sshproxy use a hostmount on master PD (don't spam sshKeys on upgrade/reboot).
Add comment describing what SSHTunnelList.Close() does. Simplify util.FileExists.
This commit is contained in:
@@ -91,7 +91,6 @@ func (s *SSHTunnel) tunnel(conn net.Conn, remoteHost, remotePort string) error {
|
||||
}
|
||||
|
||||
func (s *SSHTunnel) Close() error {
|
||||
glog.Infof("Closing tunnel for host: %q", s.Host)
|
||||
if err := s.client.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -183,6 +182,9 @@ func (l SSHTunnelList) Open() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close asynchronously closes all tunnels in the list after waiting for 1
|
||||
// minute. Tunnels will still be open upon this function's return, but should
|
||||
// no longer be used.
|
||||
func (l SSHTunnelList) Close() {
|
||||
for ix := range l {
|
||||
entry := l[ix]
|
||||
|
@@ -515,16 +515,13 @@ func ShortenString(str string, n int) string {
|
||||
} else {
|
||||
return str[:n]
|
||||
}
|
||||
}
|
||||
|
||||
func FileExists(filename string) (bool, error) {
|
||||
file, err := os.Open(filename)
|
||||
defer file.Close()
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
} else {
|
||||
return false, err
|
||||
}
|
||||
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
||||
return false, nil
|
||||
} else if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user