diff --git a/command/agent/agent.go b/command/agent/agent.go index 2b3e85c08d..1b75b56788 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -646,6 +646,7 @@ func (a *Agent) setupNodeID(config *Config) error { // If they've configured a node ID manually then just use that, as // long as it's valid. if config.NodeID != "" { + config.NodeID = types.NodeID(strings.ToLower(string(config.NodeID))) if _, err := uuid.ParseUUID(string(config.NodeID)); err != nil { return err } @@ -674,6 +675,7 @@ func (a *Agent) setupNodeID(config *Config) error { } nodeID := strings.TrimSpace(string(rawID)) + nodeID = strings.ToLower(nodeID) if _, err := uuid.ParseUUID(nodeID); err != nil { return err } diff --git a/command/agent/agent_test.go b/command/agent/agent_test.go index 08b22946c1..d66d9097a5 100644 --- a/command/agent/agent_test.go +++ b/command/agent/agent_test.go @@ -341,7 +341,7 @@ func TestAgent_NodeID(t *testing.T) { if err != nil { t.Fatalf("err: %v", err) } - c.NodeID = types.NodeID(newID) + c.NodeID = types.NodeID(strings.ToUpper(newID)) if err := agent.setupNodeID(c); err != nil { t.Fatalf("err: %v", err) } @@ -361,7 +361,7 @@ func TestAgent_NodeID(t *testing.T) { } // Set a valid ID via the file. - if err := ioutil.WriteFile(fileID, []byte("adf4238a-882b-9ddc-4a9d-5b6758e4159e"), 0600); err != nil { + if err := ioutil.WriteFile(fileID, []byte("ADF4238a-882b-9ddc-4a9d-5b6758e4159e"), 0600); err != nil { t.Fatalf("err: %v", err) } c.NodeID = ""