check if data-dir is actually a directory

This commit is contained in:
mckennajones 2016-11-22 13:33:51 -08:00
parent 2319624f69
commit 6a49edf128

View file

@ -209,6 +209,12 @@ func (c *Command) readConfig() *Config {
return nil
}
if finfo, _ := os.Stat(config.DataDir); !finfo.IsDir() {
c.Ui.Error(fmt.Sprintf("CRITICAL: The data-dir specified at %q is not a directory", config.DataDir))
c.Ui.Error("Consul will refuse to boot without a valid data directory")
c.Ui.Error("Please provide a valid directory and try starting again.")
}
// Ensure all endpoints are unique
if err := config.verifyUniqueListeners(); err != nil {
c.Ui.Error(fmt.Sprintf("All listening endpoints must be unique: %s", err))