Added error when cluster reset while using server flag

Signed-off-by: Vitor Savian <vitor.savian@suse.com>
This commit is contained in:
Vitor Savian 2023-09-26 11:00:37 -03:00 committed by GitHub
parent b010c941cf
commit b6ab24c4fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -467,6 +467,12 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
cfg.DisableAgent = true
}
// If the user uses the cluster-reset argument in a cluster that has a ServerURL, we must return an error
// to remove the server flag on the configuration or in the cli
if serverConfig.ControlConfig.JoinURL != "" {
return errors.New("cannot perform cluster-reset while server URL is set - remove server from configuration before resetting")
}
dataDir, err := datadir.LocalHome(cfg.DataDir, false)
if err != nil {
return err