diff --git a/command/agent/command.go b/command/agent/command.go index dfd24ef57e..c11b90c5cb 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -169,8 +169,8 @@ func (c *Command) readConfig() *Config { } config.NodeName = hostname } - hostname = strings.TrimSpace(hostname) - if hostname == "" { + config.NodeName = strings.TrimSpace(config.NodeName) + if config.NodeName == "" { c.Ui.Error("Node name can not be empty") return nil }