mirror of https://github.com/status-im/consul.git
Merge pull request #2529 from mckennajones/bug/1838
Give a better error message when data-dir is not a directory
This commit is contained in:
commit
cb96aa8eb3
|
@ -211,6 +211,14 @@ func (c *Command) readConfig() *Config {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if finfo, err := os.Stat(config.DataDir); err != nil {
|
||||||
|
c.Ui.Error(fmt.Sprintf("Error getting data-dir: %s", err))
|
||||||
|
return nil
|
||||||
|
} else if !finfo.IsDir() {
|
||||||
|
c.Ui.Error(fmt.Sprintf("The data-dir specified at %q is not a directory", config.DataDir))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure all endpoints are unique
|
// Ensure all endpoints are unique
|
||||||
if err := config.verifyUniqueListeners(); err != nil {
|
if err := config.verifyUniqueListeners(); err != nil {
|
||||||
c.Ui.Error(fmt.Sprintf("All listening endpoints must be unique: %s", err))
|
c.Ui.Error(fmt.Sprintf("All listening endpoints must be unique: %s", err))
|
||||||
|
|
Loading…
Reference in New Issue