From ff529ffa40e840b259f6fcb276f17998bcf1f0ed Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Thu, 31 Mar 2016 15:02:58 -0700 Subject: [PATCH] Guard against a node name containing pure whitespace --- command/agent/command.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/command/agent/command.go b/command/agent/command.go index 16025c9d5d..dfd24ef57e 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -167,14 +167,13 @@ func (c *Command) readConfig() *Config { c.Ui.Error(fmt.Sprintf("Error determining node name: %s", err)) return nil } - - hostname = strings.TrimSpace(hostname) - if hostname == "" { - c.Ui.Error("Node name can not be empty") - return nil - } config.NodeName = hostname } + hostname = strings.TrimSpace(hostname) + if hostname == "" { + c.Ui.Error("Node name can not be empty") + return nil + } // Ensure we have a data directory if config.DataDir == "" && !dev {