Unify the parameter to disable dry-run on weed shell commands to -apply (instead of -force). (#7450)
* Unify the parameter to disable dry-run on weed shell commands to --apply (instead of --force). * lint * refactor * Execution Order Corrected * handle deprecated force flag * fix help messages * Refactoring]: Using flag.FlagSet.Visit() * consistent with other commands * Checks for both flags * fix toml files --------- Co-authored-by: chrislu <chris.lu@gmail.com>
This commit is contained in:
@@ -46,7 +46,7 @@ func (c *commandVolumeFixReplication) Help() string {
|
||||
If the free slots satisfy the replication requirement, the volume content is copied over and mounted.
|
||||
|
||||
volume.fix.replication # do not take action
|
||||
volume.fix.replication -force # actually deleting or copying the volume files and mount the volume
|
||||
volume.fix.replication -apply # actually deleting or copying the volume files and mount the volume
|
||||
volume.fix.replication -collectionPattern=important* # fix any collections with prefix "important"
|
||||
|
||||
Note:
|
||||
@@ -66,7 +66,9 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,
|
||||
|
||||
volFixReplicationCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
|
||||
c.collectionPattern = volFixReplicationCommand.String("collectionPattern", "", "match with wildcard characters '*' and '?'")
|
||||
applyChanges := volFixReplicationCommand.Bool("force", false, "apply the fix")
|
||||
applyChanges := volFixReplicationCommand.Bool("apply", false, "apply the fix")
|
||||
// TODO: remove this alias
|
||||
applyChangesAlias := volFixReplicationCommand.Bool("force", false, "apply the fix (alias for -apply)")
|
||||
doDelete := volFixReplicationCommand.Bool("doDelete", true, "Also delete over-replicated volumes besides fixing under-replication")
|
||||
doCheck := volFixReplicationCommand.Bool("doCheck", true, "Also check synchronization before deleting")
|
||||
maxParallelization := volFixReplicationCommand.Int("maxParallelization", DefaultMaxParallelization, "run up to X tasks in parallel, whenever possible")
|
||||
@@ -76,8 +78,9 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,
|
||||
if err = volFixReplicationCommand.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
infoAboutSimulationMode(writer, *applyChanges, "-force")
|
||||
|
||||
handleDeprecatedForceFlag(writer, volFixReplicationCommand, applyChangesAlias, applyChanges)
|
||||
infoAboutSimulationMode(writer, *applyChanges, "-apply")
|
||||
commandEnv.noLock = !*applyChanges
|
||||
|
||||
if err = commandEnv.confirmIsLocked(args); *applyChanges && err != nil {
|
||||
|
||||
Reference in New Issue
Block a user