1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-31 14:36:32 +00:00

Warn when snapshot name contains file extension

This commit is contained in:
Sebastiaan van Steenis
2021-01-17 16:09:12 +01:00
parent 18f605e71e
commit 7bf18c61fd

View File

@@ -341,6 +341,10 @@ func RestoreEtcdSnapshotFromCli(ctx *cli.Context) error {
if etcdSnapshotName == "" { if etcdSnapshotName == "" {
return fmt.Errorf("you must specify the snapshot name to restore") return fmt.Errorf("you must specify the snapshot name to restore")
} }
// Warn user if etcdSnapshotName contains extension (should just be snapshotname, not the filename)
if strings.HasSuffix(etcdSnapshotName, ".zip") {
logrus.Warnf("The snapshot name [%s] ends with the file extension (.zip) which is not needed, the snapshot name should be provided without the extension", etcdSnapshotName)
}
// setting up the flags // setting up the flags
// flag to use local state file // flag to use local state file
useLocalState := ctx.Bool("use-local-state") useLocalState := ctx.Bool("use-local-state")