Guard against a node name containing pure whitespace

This commit is contained in:
Sean Chittenden 2016-03-31 15:02:58 -07:00
parent 583abab552
commit ff529ffa40
1 changed files with 5 additions and 6 deletions

View File

@ -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 {