mirror of
https://github.com/rancher/rke.git
synced 2025-04-27 19:25:44 +00:00
Dont deploy statefile if its not readable
This commit is contained in:
parent
05f08baddb
commit
738bda5fb6
@ -68,6 +68,16 @@ func (c *Cluster) DeployRestoreCerts(ctx context.Context, clusterCerts map[strin
|
||||
}
|
||||
|
||||
func (c *Cluster) DeployStateFile(ctx context.Context, stateFilePath, snapshotName string) error {
|
||||
stateFileExists, err := util.IsFileExists(stateFilePath)
|
||||
if err != nil {
|
||||
logrus.Warnf("Could not read cluster state file from [%s], error: [%v]. Snapshot will be created without cluster state file. You can retrieve the cluster state file using 'rke util get-state-file'", stateFilePath, err)
|
||||
return nil
|
||||
}
|
||||
if !stateFileExists {
|
||||
logrus.Warnf("Could not read cluster state file from [%s], file does not exist. Snapshot will be created without cluster state file. You can retrieve the cluster state file using 'rke util get-state-file'", stateFilePath)
|
||||
return nil
|
||||
}
|
||||
|
||||
var errgrp errgroup.Group
|
||||
hostsQueue := util.GetObjectQueue(c.EtcdHosts)
|
||||
for w := 0; w < WorkerThreads; w++ {
|
||||
|
@ -313,7 +313,7 @@ func SnapshotSaveEtcdHostsFromCli(ctx *cli.Context) error {
|
||||
etcdSnapshotName := ctx.String("name")
|
||||
if etcdSnapshotName == "" {
|
||||
etcdSnapshotName = fmt.Sprintf("rke_etcd_snapshot_%s", time.Now().Format(time.RFC3339))
|
||||
logrus.Warnf("Name of the snapshot is not specified using [%s]", etcdSnapshotName)
|
||||
logrus.Warnf("Name of the snapshot is not specified, using [%s]", etcdSnapshotName)
|
||||
}
|
||||
// setting up the flags
|
||||
flags := cluster.GetExternalFlags(false, false, false, false, "", filePath)
|
||||
|
Loading…
Reference in New Issue
Block a user