Backport cluster-reset fix (#3989)

Signed-off-by: dereknola <derek.nola@suse.com>
This commit is contained in:
Derek Nola
2021-09-10 10:48:46 -07:00
committed by GitHub
parent 11813ac822
commit 91bb478797

View File

@@ -62,17 +62,18 @@ func (c *Cluster) start(ctx context.Context) error {
rebootstrap := func() error {
return c.storageBootstrap(ctx)
}
if err := c.managedDB.Reset(ctx, rebootstrap); err != nil {
return err
}
return c.managedDB.Reset(ctx, rebootstrap)
case c.config.ClusterReset:
if _, err := os.Stat(resetFile); err != nil {
if !os.IsNotExist(err) {
return err
}
} else {
return fmt.Errorf("cluster-reset was successfully performed, please remove the cluster-reset flag and start %s normally, if you need to perform another cluster reset, you must first manually delete the %s file", version.Program, resetFile)
rebootstrap := func() error {
return c.storageBootstrap(ctx)
}
return c.managedDB.Reset(ctx, rebootstrap)
}
return fmt.Errorf("cluster-reset was successfully performed, please remove the cluster-reset flag and start %s normally, if you need to perform another cluster reset, you must first manually delete the %s file", version.Program, resetFile)
}
// removing the reset file and ignore error if the file doesn't exist