From 9c85ea0c478c4b6e98292233f46170dc21b59ca5 Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Fri, 10 Apr 2015 19:41:09 -0700 Subject: [PATCH] agent: Don't attempt migration on new server --- command/agent/command.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/command/agent/command.go b/command/agent/command.go index d6ce3539dc..294e991b9e 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -603,6 +603,12 @@ func (c *Command) Run(args []string) int { // and we have data from a previous Consul version, attempt to // migrate the data from LMDB to BoltDB using the migrator utility. if config.Server { + // If the data dir doesn't exist yet (first start), then don't + // attempt to migrate. + if _, err := os.Stat(config.DataDir); os.IsNotExist(err) { + goto AFTER_MIGRATE + } + m, err := migrator.New(config.DataDir) if err != nil { c.Ui.Error(err.Error()) @@ -621,6 +627,7 @@ func (c *Command) Run(args []string) int { } } +AFTER_MIGRATE: // Create the agent if err := c.setupAgent(config, logOutput, logWriter); err != nil { return 1