mirror of https://github.com/status-im/consul.git
Guard against a node name containing pure whitespace
This commit is contained in:
parent
583abab552
commit
ff529ffa40
|
@ -167,14 +167,13 @@ func (c *Command) readConfig() *Config {
|
||||||
c.Ui.Error(fmt.Sprintf("Error determining node name: %s", err))
|
c.Ui.Error(fmt.Sprintf("Error determining node name: %s", err))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
config.NodeName = hostname
|
||||||
|
}
|
||||||
hostname = strings.TrimSpace(hostname)
|
hostname = strings.TrimSpace(hostname)
|
||||||
if hostname == "" {
|
if hostname == "" {
|
||||||
c.Ui.Error("Node name can not be empty")
|
c.Ui.Error("Node name can not be empty")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
config.NodeName = hostname
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure we have a data directory
|
// Ensure we have a data directory
|
||||||
if config.DataDir == "" && !dev {
|
if config.DataDir == "" && !dev {
|
||||||
|
|
Loading…
Reference in New Issue