@@ -10,6 +10,7 @@ import (
1010 "github.com/coreos/fleet/client"
1111 "github.com/coreos/fleet/etcd"
1212 "github.com/coreos/fleet/machine"
13+ "github.com/coreos/fleet/pkg"
1314 "github.com/coreos/fleet/registry"
1415 "github.com/coreos/fleet/ssh"
1516)
@@ -28,6 +29,7 @@ var Flags = struct {
2829 StrictHostKeyChecking bool
2930 Tunnel string
3031 RequestTimeout float64
32+ SSHTimeout float64
3133}{}
3234
3335const (
@@ -68,9 +70,10 @@ func getFakeClient() (*registry.FakeRegistry, error) {
6870
6971func getRegistryClient () (client.API , error ) {
7072 var dial func (string , string ) (net.Conn , error )
73+ sshTimeout := time .Duration (Flags .SSHTimeout * 1000 ) * time .Millisecond
7174 tun := getTunnelFlag ()
7275 if tun != "" {
73- sshClient , err := ssh .NewSSHClient ("core" , tun , getChecker (), false )
76+ sshClient , err := ssh .NewSSHClient ("core" , tun , getChecker (), false , sshTimeout )
7477 if err != nil {
7578 return nil , fmt .Errorf ("failed initializing SSH client: %v" , err )
7679 }
@@ -84,27 +87,27 @@ func getRegistryClient() (client.API, error) {
8487 }
8588 }
8689
87- tlsConfig , err := etcd .ReadTLSConfigFiles (Flags .EtcdCAFile , Flags .EtcdCertFile , Flags .EtcdKeyFile )
90+ tlsConfig , err := pkg .ReadTLSConfigFiles (Flags .EtcdCAFile , Flags .EtcdCertFile , Flags .EtcdKeyFile )
8891 if err != nil {
8992 return nil , err
9093 }
9194
92- trans := http.Transport {
95+ trans := & http.Transport {
9396 Dial : dial ,
9497 TLSClientConfig : tlsConfig ,
9598 }
9699
97100 timeout := time .Duration (Flags .RequestTimeout * 1000 ) * time .Millisecond
98101 machines := []string {Flags .Endpoint }
99- eClient , err := etcd .NewClient (machines , & trans , timeout )
102+ eClient , err := etcd .NewClient (machines , trans , timeout )
100103 if err != nil {
101104 return nil , err
102105 }
103106
104107 reg := registry .NewEtcdRegistry (eClient , Flags .EtcdKeyPrefix )
105108
106109 // if msg, ok := checkVersion(reg); !ok {
107- // fmt.Fprint(os.Stderr, msg)
110+ // stderr( msg)
108111 // }
109112
110113 return & client.RegistryClient {Registry : reg }, nil
0 commit comments