From d6dc6a1fcc78825c602b781cd2e9abb59b021ca1 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Wed, 14 Dec 2016 22:11:16 -0800 Subject: [PATCH] Adds exception for data-dir check in -dev mode. This was changed in #2529. --- command/agent/command.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/command/agent/command.go b/command/agent/command.go index 6138e637fb..dcb9ceb044 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -205,18 +205,20 @@ func (c *Command) readConfig() *Config { config.SkipLeaveOnInt = Bool(config.Server) } - // Ensure we have a data directory - if config.DataDir == "" && !dev { - c.Ui.Error("Must specify data directory using -data-dir") - return nil - } + // Ensure we have a data directory if we are not in dev mode. + if !dev { + if config.DataDir == "" { + c.Ui.Error("Must specify data directory using -data-dir") + 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 + 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