Browse Source

help message when in simulation mode

pull/3132/head
chrislu 3 years ago
parent
commit
6793bc853c
  1. 1
      weed/shell/command_collection_delete.go
  2. 1
      weed/shell/command_ec_balance.go
  3. 1
      weed/shell/command_ec_decode.go
  4. 1
      weed/shell/command_ec_rebuild.go
  5. 8
      weed/shell/command_fs_configure.go
  6. 2
      weed/shell/command_remote_mount_buckets.go
  7. 1
      weed/shell/command_s3_bucket_quota_check.go
  8. 3
      weed/shell/command_s3_configure.go
  9. 1
      weed/shell/command_volume_balance.go
  10. 1
      weed/shell/command_volume_check_disk.go
  11. 1
      weed/shell/command_volume_delete_empty.go
  12. 1
      weed/shell/command_volume_server_evacuate.go
  13. 1
      weed/shell/command_volume_tier_move.go

1
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

1
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

1
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

1
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

8
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)
}

2
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)

1
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)

3
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,

1
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

1
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

1
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

1
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

1
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

Loading…
Cancel
Save