Fixed a bunch of TLS related failures

This commit is contained in:
Diptanu Choudhury
2016-10-26 14:08:46 -07:00
parent 48c31de849
commit b2bbd63d87
6 changed files with 16 additions and 9 deletions

View File

@@ -4,8 +4,6 @@ import (
"fmt"
"sort"
"strconv"
"github.com/hashicorp/go-cleanhttp"
)
// Nodes is used to query node-related API endpoints
@@ -82,10 +80,7 @@ func (n *Nodes) Stats(nodeID string, q *QueryOptions) (*HostStats, error) {
if node.HTTPAddr == "" {
return nil, fmt.Errorf("http addr of the node %q is running is not advertised", nodeID)
}
client, err := NewClient(&Config{
Address: fmt.Sprintf("http://%s", node.HTTPAddr),
HttpClient: cleanhttp.DefaultClient(),
})
client, err := NewClient(n.client.config.CopyConfig(node.HTTPAddr, node.TLSEnabled))
if err != nil {
return nil, err
}

View File

@@ -158,6 +158,7 @@ func DefaultConfig() *Config {
LogOutput: os.Stderr,
Region: "global",
StatsCollectionInterval: 1 * time.Second,
TLSConfig: &config.TLSConfig{},
}
}

View File

@@ -136,7 +136,7 @@ func TestConfig_Parse(t *testing.T) {
TaskTokenTTL: "1s",
Token: "12345",
},
TLSConfig: &TLSConfig{
TLSConfig: &config.TLSConfig{
EnableHTTP: true,
EnableRPC: true,
VerifyServerHostname: true,

View File

@@ -16,7 +16,6 @@ import (
"time"
"github.com/hashicorp/nomad/client/allocdir"
"github.com/hashicorp/nomad/nomad/structs"
"github.com/hashicorp/nomad/testutil"
"github.com/ugorji/go/codec"
)

View File

@@ -18,7 +18,18 @@ func TestMeta_FlagSet(t *testing.T) {
},
{
FlagSetClient,
[]string{"address", "no-color", "region"},
[]string{
"address",
"no-color",
"region",
"address",
"ca-cert",
"ca-path",
"client-cert",
"client-key",
"insecure",
"tls-skip-verify",
},
},
}

View File

@@ -243,6 +243,7 @@ func DefaultConfig() *Config {
ConsulConfig: config.DefaultConsulConfig(),
VaultConfig: config.DefaultVaultConfig(),
RPCHoldTimeout: 5 * time.Second,
TLSConfig: &config.TLSConfig{},
}
// Enable all known schedulers by default