Skip to content

Commit

Permalink
Merge pull request #2529 from mckennajones/bug/1838
Browse files Browse the repository at this point in the history
Give a better error message when data-dir is not a directory
  • Loading branch information
kyhavlov authored Dec 15, 2016
2 parents 42113d0 + daa5ba8 commit cb96aa8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit cb96aa8

Please sign in to comment.