aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_fs_configure.go
diff options
context:
space:
mode:
authorMatt <washcycle@users.noreply.github.com>2023-04-05 00:07:17 -0500
committerGitHub <noreply@github.com>2023-04-04 22:07:17 -0700
commit2d213d87e1c3692f2d0f7be83f6a08049eaf70a9 (patch)
tree883cd2d174c89e0f2f022fd61b9b09047ed818b9 /weed/shell/command_fs_configure.go
parentefef6e94bff9b898748083fbe5d5b00fffc9f2fb (diff)
downloadseaweedfs-2d213d87e1c3692f2d0f7be83f6a08049eaf70a9.tar.xz
seaweedfs-2d213d87e1c3692f2d0f7be83f6a08049eaf70a9.zip
File Path Configuration TTL Validation (#4376)
* compatibility patch for csi driver * added namespace to all component parameters * added namespace to all component parameters * dereference in range * added namespace to values.yml defaults * added namespace to s3 component * added helm chart to github pages * added helm chart to github pages * added helm chart to github pages * added helm chart to github pages * added helm chart to github pages * push on all tags * push on all tags * push on all tags * push on all tags * push on all tags * changed helm directory structure * update charts location * fixed dereference * updated permissions * updated permissions * match current action schema * added helm chart liniting CI * modified chart list changed * fixed nodejs warning * standardized a few defaults * added chart dirs * lowerd period seconds for volume startup to test chart lint changes * lowerd period seconds for volume startup to test chart lint changes * test * changed back * adjustment * debug ls statment * removed change detection * remvoed change detection * always lint the charts * added missing ) * fixed typo * added spaces in front of all comments * pdated values.yaml * pdated values.yaml * don't validate maintainers for now * update helm_ci.yml * update helm_ci.yml * update helm_ci.yml * update helm_ci.yml * update helm_ci.yml * - adds helm chart lint on changes - adds test helm chart install on k8s * updated helm chart readme.md * added artifact hub * added artifact hub * added ttl validation
Diffstat (limited to 'weed/shell/command_fs_configure.go')
-rw-r--r--weed/shell/command_fs_configure.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/weed/shell/command_fs_configure.go b/weed/shell/command_fs_configure.go
index 60edb79c2..d09ea0882 100644
--- a/weed/shell/command_fs_configure.go
+++ b/weed/shell/command_fs_configure.go
@@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"io"
+ "regexp"
"strings"
"github.com/seaweedfs/seaweedfs/weed/filer"
@@ -51,7 +52,7 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer io
locationPrefix := fsConfigureCommand.String("locationPrefix", "", "path prefix, required to update the path-specific configuration")
collection := fsConfigureCommand.String("collection", "", "assign writes to this collection")
replication := fsConfigureCommand.String("replication", "", "assign writes with this replication")
- ttl := fsConfigureCommand.String("ttl", "", "assign writes with this ttl")
+ ttl := fsConfigureCommand.String("ttl", "", "assign writes with this ttl (e.g., 1m, 1h, 1d, 1w, 1y)")
diskType := fsConfigureCommand.String("disk", "", "[hdd|ssd|<tag>] hard drive or solid state drive or any tag")
fsync := fsConfigureCommand.Bool("fsync", false, "fsync for the writes")
isReadOnly := fsConfigureCommand.Bool("readOnly", false, "disable writes")
@@ -102,6 +103,16 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer io
}
}
+ // check ttl
+ if *ttl != "" {
+ regex := "^[1-9][0-9]*[mhdwMy]$"
+ match, _ := regexp.MatchString(regex, *ttl)
+
+ if !match {
+ return fmt.Errorf("ttl should be of the following format (e.g., 1m, 1h, 1d, 1w, 1y)")
+ }
+ }
+
// save it
if *isDelete {
fc.DeleteLocationConf(*locationPrefix)