Fix inplace update for pre secret node

This commit is contained in:
Alex Dadgar 2016-10-26 22:05:44 -07:00
parent 6c527581af
commit 03fde26656
3 changed files with 2 additions and 16 deletions

View File

@ -11,17 +11,3 @@ server {
# Self-elect, should be 3 or 5 for production
bootstrap_expect = 1
}
vault {
address = "https://10.0.0.231:8200"
token = "6e073f4b-4a6d-1fde-812e-7ff65dd3f4fa"
#allow_unauthenticated = true
task_token_ttl = "5m"
#enabled = true
#tls_ca_file = "/etc/ssl/cluster/ca.pem"
#tls_ca_path = "/etc/ssl/cluster"
#tls_cert_file = "/etc/ssl/cluster/cert.pem"
#tls_key_file = "/etc/ssl/cluster/key.pem"
tls_server_name = "vault"
tls_skip_verify = true
}

View File

@ -110,7 +110,7 @@ func (n *Node) Register(args *structs.NodeRegisterRequest, reply *structs.NodeUp
// Check if the SecretID has been tampered with
if !pre && originalNode != nil {
if args.Node.SecretID != originalNode.SecretID {
if args.Node.SecretID != originalNode.SecretID && originalNode.SecretID != "" {
return fmt.Errorf("node secret ID does not match. Not registering node.")
}
}

View File

@ -77,7 +77,7 @@ func TestClientEndpoint_Register_NoSecret(t *testing.T) {
// Update the node to be pre-0.5
node.Attributes["nomad.version"] = "0.4.1"
if err := msgpackrpc.CallWithCodec(codec, "Node.Register", req, &resp); err != nil {
t.Fatalf("Expecting error regarding missing secret id", err)
t.Fatalf("Not expecting err: %v", err)
}
if resp.Index == 0 {
t.Fatalf("bad index: %d", resp.Index)