mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-28 13:31:27 +08:00
Merge pull request #2209 from combineads/fuse_option
Fix error handling
This commit is contained in:
commit
cc32436d63
@ -62,7 +62,7 @@ func runFuse(cmd *Command, args []string) bool {
|
|||||||
option.WriteByte(rawArgs[i])
|
option.WriteByte(rawArgs[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
// single quote separator read option until next single quote
|
// single quote separator read option until next single quote
|
||||||
} else if rawArgs[i] == '\'' {
|
} else if rawArgs[i] == '\'' {
|
||||||
for i++; i < rawArgsLen && rawArgs[i] != '\''; i++ {
|
for i++; i < rawArgsLen && rawArgs[i] != '\''; i++ {
|
||||||
option.WriteByte(rawArgs[i])
|
option.WriteByte(rawArgs[i])
|
||||||
@ -109,7 +109,7 @@ func runFuse(cmd *Command, args []string) bool {
|
|||||||
case "filer.path":
|
case "filer.path":
|
||||||
mountOptions.filerMountRootPath = ¶meter.value
|
mountOptions.filerMountRootPath = ¶meter.value
|
||||||
case "dirAutoCreate":
|
case "dirAutoCreate":
|
||||||
if parsed, err := strconv.ParseBool(parameter.value); err != nil {
|
if parsed, err := strconv.ParseBool(parameter.value); err == nil {
|
||||||
mountOptions.dirAutoCreate = &parsed
|
mountOptions.dirAutoCreate = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("dirAutoCreate: %s", err))
|
panic(fmt.Errorf("dirAutoCreate: %s", err))
|
||||||
@ -121,14 +121,14 @@ func runFuse(cmd *Command, args []string) bool {
|
|||||||
case "disk":
|
case "disk":
|
||||||
mountOptions.diskType = ¶meter.value
|
mountOptions.diskType = ¶meter.value
|
||||||
case "ttl":
|
case "ttl":
|
||||||
if parsed, err := strconv.ParseInt(parameter.value, 0, 32); err != nil {
|
if parsed, err := strconv.ParseInt(parameter.value, 0, 32); err == nil {
|
||||||
intValue := int(parsed)
|
intValue := int(parsed)
|
||||||
mountOptions.ttlSec = &intValue
|
mountOptions.ttlSec = &intValue
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("ttl: %s", err))
|
panic(fmt.Errorf("ttl: %s", err))
|
||||||
}
|
}
|
||||||
case "chunkSizeLimitMB":
|
case "chunkSizeLimitMB":
|
||||||
if parsed, err := strconv.ParseInt(parameter.value, 0, 32); err != nil {
|
if parsed, err := strconv.ParseInt(parameter.value, 0, 32); err == nil {
|
||||||
intValue := int(parsed)
|
intValue := int(parsed)
|
||||||
mountOptions.chunkSizeLimitMB = &intValue
|
mountOptions.chunkSizeLimitMB = &intValue
|
||||||
} else {
|
} else {
|
||||||
@ -136,7 +136,7 @@ func runFuse(cmd *Command, args []string) bool {
|
|||||||
}
|
}
|
||||||
case "concurrentWriters":
|
case "concurrentWriters":
|
||||||
i++
|
i++
|
||||||
if parsed, err := strconv.ParseInt(parameter.value, 0, 32); err != nil {
|
if parsed, err := strconv.ParseInt(parameter.value, 0, 32); err == nil {
|
||||||
intValue := int(parsed)
|
intValue := int(parsed)
|
||||||
mountOptions.concurrentWriters = &intValue
|
mountOptions.concurrentWriters = &intValue
|
||||||
} else {
|
} else {
|
||||||
@ -145,7 +145,7 @@ func runFuse(cmd *Command, args []string) bool {
|
|||||||
case "cacheDir":
|
case "cacheDir":
|
||||||
mountOptions.cacheDir = ¶meter.value
|
mountOptions.cacheDir = ¶meter.value
|
||||||
case "cacheCapacityMB":
|
case "cacheCapacityMB":
|
||||||
if parsed, err := strconv.ParseInt(parameter.value, 0, 64); err != nil {
|
if parsed, err := strconv.ParseInt(parameter.value, 0, 64); err == nil {
|
||||||
mountOptions.cacheSizeMB = &parsed
|
mountOptions.cacheSizeMB = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("cacheCapacityMB: %s", err))
|
panic(fmt.Errorf("cacheCapacityMB: %s", err))
|
||||||
@ -153,7 +153,7 @@ func runFuse(cmd *Command, args []string) bool {
|
|||||||
case "dataCenter":
|
case "dataCenter":
|
||||||
mountOptions.dataCenter = ¶meter.value
|
mountOptions.dataCenter = ¶meter.value
|
||||||
case "allowOthers":
|
case "allowOthers":
|
||||||
if parsed, err := strconv.ParseBool(parameter.value); err != nil {
|
if parsed, err := strconv.ParseBool(parameter.value); err == nil {
|
||||||
mountOptions.allowOthers = &parsed
|
mountOptions.allowOthers = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("allowOthers: %s", err))
|
panic(fmt.Errorf("allowOthers: %s", err))
|
||||||
@ -161,7 +161,7 @@ func runFuse(cmd *Command, args []string) bool {
|
|||||||
case "umask":
|
case "umask":
|
||||||
mountOptions.umaskString = ¶meter.value
|
mountOptions.umaskString = ¶meter.value
|
||||||
case "nonempty":
|
case "nonempty":
|
||||||
if parsed, err := strconv.ParseBool(parameter.value); err != nil {
|
if parsed, err := strconv.ParseBool(parameter.value); err == nil {
|
||||||
mountOptions.nonempty = &parsed
|
mountOptions.nonempty = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("nonempty: %s", err))
|
panic(fmt.Errorf("nonempty: %s", err))
|
||||||
@ -173,7 +173,7 @@ func runFuse(cmd *Command, args []string) bool {
|
|||||||
case "map.gid":
|
case "map.gid":
|
||||||
mountOptions.gidMap = ¶meter.value
|
mountOptions.gidMap = ¶meter.value
|
||||||
case "readOnly":
|
case "readOnly":
|
||||||
if parsed, err := strconv.ParseBool(parameter.value); err != nil {
|
if parsed, err := strconv.ParseBool(parameter.value); err == nil {
|
||||||
mountOptions.readOnly = &parsed
|
mountOptions.readOnly = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("readOnly: %s", err))
|
panic(fmt.Errorf("readOnly: %s", err))
|
||||||
@ -183,7 +183,7 @@ func runFuse(cmd *Command, args []string) bool {
|
|||||||
case "memprofile":
|
case "memprofile":
|
||||||
mountMemProfile = ¶meter.value
|
mountMemProfile = ¶meter.value
|
||||||
case "readRetryTime":
|
case "readRetryTime":
|
||||||
if parsed, err := time.ParseDuration(parameter.value); err != nil {
|
if parsed, err := time.ParseDuration(parameter.value); err == nil {
|
||||||
mountReadRetryTime = &parsed
|
mountReadRetryTime = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("readRetryTime: %s", err))
|
panic(fmt.Errorf("readRetryTime: %s", err))
|
||||||
|
Loading…
Reference in New Issue
Block a user