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:
Kyle Havlovitz 2016-12-14 20:21:10 -05:00 committed by GitHub
commit cb96aa8eb3
1 changed files with 8 additions and 0 deletions

View File

@ -211,6 +211,14 @@ func (c *Command) readConfig() *Config {
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
if err := config.verifyUniqueListeners(); err != nil {
c.Ui.Error(fmt.Sprintf("All listening endpoints must be unique: %s", err))