help message when in simulation mode

This commit is contained in:
chrislu 2022-05-31 14:48:46 -07:00
parent 89948a373b
commit 6793bc853c
13 changed files with 21 additions and 2 deletions

View file

@ -35,6 +35,7 @@ func (c *commandCollectionDelete) Do(args []string, commandEnv *CommandEnv, writ
if err = colDeleteCommand.Parse(args); err != nil { if err = colDeleteCommand.Parse(args); err != nil {
return nil return nil
} }
infoAboutSimulationMode(writer, *applyBalancing, "-force")
if err = commandEnv.confirmIsLocked(args); err != nil { if err = commandEnv.confirmIsLocked(args); err != nil {
return return

View file

@ -106,6 +106,7 @@ func (c *commandEcBalance) Do(args []string, commandEnv *CommandEnv, writer io.W
if err = balanceCommand.Parse(args); err != nil { if err = balanceCommand.Parse(args); err != nil {
return nil return nil
} }
infoAboutSimulationMode(writer, *applyBalancing, "-force")
if err = commandEnv.confirmIsLocked(args); err != nil { if err = commandEnv.confirmIsLocked(args); err != nil {
return return

View file

@ -46,6 +46,7 @@ func (c *commandEcDecode) Do(args []string, commandEnv *CommandEnv, writer io.Wr
if err = encodeCommand.Parse(args); err != nil { if err = encodeCommand.Parse(args); err != nil {
return nil return nil
} }
infoAboutSimulationMode(writer, *forceChanges, "-force")
if err = commandEnv.confirmIsLocked(args); err != nil { if err = commandEnv.confirmIsLocked(args); err != nil {
return return

View file

@ -63,6 +63,7 @@ func (c *commandEcRebuild) Do(args []string, commandEnv *CommandEnv, writer io.W
if err = fixCommand.Parse(args); err != nil { if err = fixCommand.Parse(args); err != nil {
return nil return nil
} }
infoAboutSimulationMode(writer, *applyChanges, "-force")
if err = commandEnv.confirmIsLocked(args); err != nil { if err = commandEnv.confirmIsLocked(args); err != nil {
return return

View file

@ -71,6 +71,7 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer io
} }
if *locationPrefix != "" { if *locationPrefix != "" {
infoAboutSimulationMode(writer, *apply, "-apply")
locConf := &filer_pb.FilerConf_PathConf{ locConf := &filer_pb.FilerConf_PathConf{
LocationPrefix: *locationPrefix, LocationPrefix: *locationPrefix,
Collection: *collection, Collection: *collection,
@ -128,3 +129,10 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer io
return nil 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)
}

View file

@ -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 '?'") 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'") 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") apply := remoteMountBucketsCommand.Bool("apply", false, "apply the mount for listed buckets")
if err = remoteMountBucketsCommand.Parse(args); err != nil { if err = remoteMountBucketsCommand.Parse(args); err != nil {
return nil return nil
} }
infoAboutSimulationMode(writer, *apply, "-apply")
if *remote == "" { if *remote == "" {
_, err = listExistingRemoteStorageMounts(commandEnv, writer) _, err = listExistingRemoteStorageMounts(commandEnv, writer)

View file

@ -36,6 +36,7 @@ func (c *commandS3BucketQuotaEnforce) Do(args []string, commandEnv *CommandEnv,
if err = bucketCommand.Parse(args); err != nil { if err = bucketCommand.Parse(args); err != nil {
return nil return nil
} }
infoAboutSimulationMode(writer, *applyQuotaLimit, "-apply")
// collect collection information // collect collection information
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0) topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)

View file

@ -42,7 +42,6 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io
secretKey := s3ConfigureCommand.String("secret_key", "", "specify the secret key") secretKey := s3ConfigureCommand.String("secret_key", "", "specify the secret key")
isDelete := s3ConfigureCommand.Bool("delete", false, "delete users, actions or access keys") isDelete := s3ConfigureCommand.Bool("delete", false, "delete users, actions or access keys")
apply := s3ConfigureCommand.Bool("apply", false, "update and apply s3 configuration") apply := s3ConfigureCommand.Bool("apply", false, "update and apply s3 configuration")
if err = s3ConfigureCommand.Parse(args); err != nil { if err = s3ConfigureCommand.Parse(args); err != nil {
return nil return nil
} }
@ -83,6 +82,7 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io
} }
} }
if changed { if changed {
infoAboutSimulationMode(writer, *apply, "-apply")
if *isDelete { if *isDelete {
var exists []int var exists []int
for _, cmdAction := range cmdActions { for _, cmdAction := range cmdActions {
@ -151,6 +151,7 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io
} }
} }
} else if *user != "" && *actions != "" { } else if *user != "" && *actions != "" {
infoAboutSimulationMode(writer, *apply, "-apply")
identity := iam_pb.Identity{ identity := iam_pb.Identity{
Name: *user, Name: *user,
Actions: cmdActions, Actions: cmdActions,

View file

@ -70,6 +70,7 @@ func (c *commandVolumeBalance) Do(args []string, commandEnv *CommandEnv, writer
if err = balanceCommand.Parse(args); err != nil { if err = balanceCommand.Parse(args); err != nil {
return nil return nil
} }
infoAboutSimulationMode(writer, *applyBalancing, "-force")
if err = commandEnv.confirmIsLocked(args); err != nil { if err = commandEnv.confirmIsLocked(args); err != nil {
return return

View file

@ -51,6 +51,7 @@ func (c *commandVolumeCheckDisk) Do(args []string, commandEnv *CommandEnv, write
if err = fsckCommand.Parse(args); err != nil { if err = fsckCommand.Parse(args); err != nil {
return nil return nil
} }
infoAboutSimulationMode(writer, *applyChanges, "-force")
if err = commandEnv.confirmIsLocked(args); err != nil { if err = commandEnv.confirmIsLocked(args); err != nil {
return return

View file

@ -39,6 +39,7 @@ func (c *commandVolumeDeleteEmpty) Do(args []string, commandEnv *CommandEnv, wri
if err = volDeleteCommand.Parse(args); err != nil { if err = volDeleteCommand.Parse(args); err != nil {
return nil return nil
} }
infoAboutSimulationMode(writer, *applyBalancing, "-force")
if err = commandEnv.confirmIsLocked(args); err != nil { if err = commandEnv.confirmIsLocked(args); err != nil {
return return

View file

@ -52,6 +52,7 @@ func (c *commandVolumeServerEvacuate) Do(args []string, commandEnv *CommandEnv,
if err = vsEvacuateCommand.Parse(args); err != nil { if err = vsEvacuateCommand.Parse(args); err != nil {
return nil return nil
} }
infoAboutSimulationMode(writer, *applyChange, "-force")
if err = commandEnv.confirmIsLocked(args); err != nil { if err = commandEnv.confirmIsLocked(args); err != nil {
return return

View file

@ -61,6 +61,7 @@ func (c *commandVolumeTierMove) Do(args []string, commandEnv *CommandEnv, writer
if err = tierCommand.Parse(args); err != nil { if err = tierCommand.Parse(args); err != nil {
return nil return nil
} }
infoAboutSimulationMode(writer, *applyChange, "-force")
if err = commandEnv.confirmIsLocked(args); err != nil { if err = commandEnv.confirmIsLocked(args); err != nil {
return return