mirror of https://github.com/status-im/consul.git
agent: Don't attempt migration on new server
This commit is contained in:
parent
9c4cf509a8
commit
9c85ea0c47
|
@ -603,6 +603,12 @@ func (c *Command) Run(args []string) int {
|
||||||
// and we have data from a previous Consul version, attempt to
|
// and we have data from a previous Consul version, attempt to
|
||||||
// migrate the data from LMDB to BoltDB using the migrator utility.
|
// migrate the data from LMDB to BoltDB using the migrator utility.
|
||||||
if config.Server {
|
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)
|
m, err := migrator.New(config.DataDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Ui.Error(err.Error())
|
c.Ui.Error(err.Error())
|
||||||
|
@ -621,6 +627,7 @@ func (c *Command) Run(args []string) int {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AFTER_MIGRATE:
|
||||||
// Create the agent
|
// Create the agent
|
||||||
if err := c.setupAgent(config, logOutput, logWriter); err != nil {
|
if err := c.setupAgent(config, logOutput, logWriter); err != nil {
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in New Issue