diff --git a/weed/shell/command_collection_delete.go b/weed/shell/command_collection_delete.go index 55c8ddf19..b89fe7fc0 100644 --- a/weed/shell/command_collection_delete.go +++ b/weed/shell/command_collection_delete.go @@ -35,6 +35,7 @@ func (c *commandCollectionDelete) Do(args []string, commandEnv *CommandEnv, writ if err = colDeleteCommand.Parse(args); err != nil { return nil } + infoAboutSimulationMode(writer, *applyBalancing, "-force") if err = commandEnv.confirmIsLocked(args); err != nil { return diff --git a/weed/shell/command_ec_balance.go b/weed/shell/command_ec_balance.go index 393d44b80..5641c6954 100644 --- a/weed/shell/command_ec_balance.go +++ b/weed/shell/command_ec_balance.go @@ -106,6 +106,7 @@ func (c *commandEcBalance) Do(args []string, commandEnv *CommandEnv, writer io.W if err = balanceCommand.Parse(args); err != nil { return nil } + infoAboutSimulationMode(writer, *applyBalancing, "-force") if err = commandEnv.confirmIsLocked(args); err != nil { return diff --git a/weed/shell/command_ec_decode.go b/weed/shell/command_ec_decode.go index de22990fa..59c5bf83a 100644 --- a/weed/shell/command_ec_decode.go +++ b/weed/shell/command_ec_decode.go @@ -46,6 +46,7 @@ func (c *commandEcDecode) Do(args []string, commandEnv *CommandEnv, writer io.Wr if err = encodeCommand.Parse(args); err != nil { return nil } + infoAboutSimulationMode(writer, *forceChanges, "-force") if err = commandEnv.confirmIsLocked(args); err != nil { return diff --git a/weed/shell/command_ec_rebuild.go b/weed/shell/command_ec_rebuild.go index f5d1166d2..a2e1f4d44 100644 --- a/weed/shell/command_ec_rebuild.go +++ b/weed/shell/command_ec_rebuild.go @@ -63,6 +63,7 @@ func (c *commandEcRebuild) Do(args []string, commandEnv *CommandEnv, writer io.W if err = fixCommand.Parse(args); err != nil { return nil } + infoAboutSimulationMode(writer, *applyChanges, "-force") if err = commandEnv.confirmIsLocked(args); err != nil { return diff --git a/weed/shell/command_fs_configure.go b/weed/shell/command_fs_configure.go index 73bb8e5c6..2c4ef2211 100644 --- a/weed/shell/command_fs_configure.go +++ b/weed/shell/command_fs_configure.go @@ -71,6 +71,7 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer io } if *locationPrefix != "" { + infoAboutSimulationMode(writer, *apply, "-apply") locConf := &filer_pb.FilerConf_PathConf{ LocationPrefix: *locationPrefix, Collection: *collection, @@ -128,3 +129,10 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer io return nil } + +func infoAboutSimulationMode(writer io.Writer, forceMode bool, forceModeOption string) { + if forceMode { + return + } + fmt.Fprintf(writer, "Running in simulation mode. Use \"%s\" option to apply the changes.\n", forceModeOption) +} diff --git a/weed/shell/command_remote_mount_buckets.go b/weed/shell/command_remote_mount_buckets.go index c4411e639..3ed22936f 100644 --- a/weed/shell/command_remote_mount_buckets.go +++ b/weed/shell/command_remote_mount_buckets.go @@ -46,10 +46,10 @@ func (c *commandRemoteMountBuckets) Do(args []string, commandEnv *CommandEnv, wr bucketPattern := remoteMountBucketsCommand.String("bucketPattern", "", "match existing bucket name with wildcard characters '*' and '?'") trimBucketSuffix := remoteMountBucketsCommand.Bool("trimBucketSuffix", true, "remote suffix auto generated by 'weed filer.remote.sync'") apply := remoteMountBucketsCommand.Bool("apply", false, "apply the mount for listed buckets") - if err = remoteMountBucketsCommand.Parse(args); err != nil { return nil } + infoAboutSimulationMode(writer, *apply, "-apply") if *remote == "" { _, err = listExistingRemoteStorageMounts(commandEnv, writer) diff --git a/weed/shell/command_s3_bucket_quota_check.go b/weed/shell/command_s3_bucket_quota_check.go index 0e0665cc6..f2a0d14f9 100644 --- a/weed/shell/command_s3_bucket_quota_check.go +++ b/weed/shell/command_s3_bucket_quota_check.go @@ -36,6 +36,7 @@ func (c *commandS3BucketQuotaEnforce) Do(args []string, commandEnv *CommandEnv, if err = bucketCommand.Parse(args); err != nil { return nil } + infoAboutSimulationMode(writer, *applyQuotaLimit, "-apply") // collect collection information topologyInfo, _, err := collectTopologyInfo(commandEnv, 0) diff --git a/weed/shell/command_s3_configure.go b/weed/shell/command_s3_configure.go index cefb1deeb..ddcafd847 100644 --- a/weed/shell/command_s3_configure.go +++ b/weed/shell/command_s3_configure.go @@ -42,7 +42,6 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io secretKey := s3ConfigureCommand.String("secret_key", "", "specify the secret key") isDelete := s3ConfigureCommand.Bool("delete", false, "delete users, actions or access keys") apply := s3ConfigureCommand.Bool("apply", false, "update and apply s3 configuration") - if err = s3ConfigureCommand.Parse(args); err != nil { return nil } @@ -83,6 +82,7 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io } } if changed { + infoAboutSimulationMode(writer, *apply, "-apply") if *isDelete { var exists []int for _, cmdAction := range cmdActions { @@ -151,6 +151,7 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io } } } else if *user != "" && *actions != "" { + infoAboutSimulationMode(writer, *apply, "-apply") identity := iam_pb.Identity{ Name: *user, Actions: cmdActions, diff --git a/weed/shell/command_volume_balance.go b/weed/shell/command_volume_balance.go index b01d348c5..462143e25 100644 --- a/weed/shell/command_volume_balance.go +++ b/weed/shell/command_volume_balance.go @@ -70,6 +70,7 @@ func (c *commandVolumeBalance) Do(args []string, commandEnv *CommandEnv, writer if err = balanceCommand.Parse(args); err != nil { return nil } + infoAboutSimulationMode(writer, *applyBalancing, "-force") if err = commandEnv.confirmIsLocked(args); err != nil { return diff --git a/weed/shell/command_volume_check_disk.go b/weed/shell/command_volume_check_disk.go index daa64c1bd..6a22a0273 100644 --- a/weed/shell/command_volume_check_disk.go +++ b/weed/shell/command_volume_check_disk.go @@ -51,6 +51,7 @@ func (c *commandVolumeCheckDisk) Do(args []string, commandEnv *CommandEnv, write if err = fsckCommand.Parse(args); err != nil { return nil } + infoAboutSimulationMode(writer, *applyChanges, "-force") if err = commandEnv.confirmIsLocked(args); err != nil { return diff --git a/weed/shell/command_volume_delete_empty.go b/weed/shell/command_volume_delete_empty.go index 2d842e80a..79e61d38d 100644 --- a/weed/shell/command_volume_delete_empty.go +++ b/weed/shell/command_volume_delete_empty.go @@ -39,6 +39,7 @@ func (c *commandVolumeDeleteEmpty) Do(args []string, commandEnv *CommandEnv, wri if err = volDeleteCommand.Parse(args); err != nil { return nil } + infoAboutSimulationMode(writer, *applyBalancing, "-force") if err = commandEnv.confirmIsLocked(args); err != nil { return diff --git a/weed/shell/command_volume_server_evacuate.go b/weed/shell/command_volume_server_evacuate.go index f07ea4b79..4adce095d 100644 --- a/weed/shell/command_volume_server_evacuate.go +++ b/weed/shell/command_volume_server_evacuate.go @@ -52,6 +52,7 @@ func (c *commandVolumeServerEvacuate) Do(args []string, commandEnv *CommandEnv, if err = vsEvacuateCommand.Parse(args); err != nil { return nil } + infoAboutSimulationMode(writer, *applyChange, "-force") if err = commandEnv.confirmIsLocked(args); err != nil { return diff --git a/weed/shell/command_volume_tier_move.go b/weed/shell/command_volume_tier_move.go index 42cd3cf44..4528ca98d 100644 --- a/weed/shell/command_volume_tier_move.go +++ b/weed/shell/command_volume_tier_move.go @@ -61,6 +61,7 @@ func (c *commandVolumeTierMove) Do(args []string, commandEnv *CommandEnv, writer if err = tierCommand.Parse(args); err != nil { return nil } + infoAboutSimulationMode(writer, *applyChange, "-force") if err = commandEnv.confirmIsLocked(args); err != nil { return