diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2019-11-11 22:48:43 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-11 22:48:43 -0800 |
| commit | 5d61b67e62deabd538b8e6e5374aa5883db02fe2 (patch) | |
| tree | 616583cdfdd2803465345fee4ee4cdbcba5f72aa /weed/command/shell.go | |
| parent | ee90236a972acea8722dccfa1b04926d551fc82d (diff) | |
| parent | 46755ea1e1e4d79e4c0368aa7fcb17ee8aa812cc (diff) | |
| download | seaweedfs-5d61b67e62deabd538b8e6e5374aa5883db02fe2.tar.xz seaweedfs-5d61b67e62deabd538b8e6e5374aa5883db02fe2.zip | |
Merge pull request #1115 from iliul/enhanced-master-logic
fix master maintenance logic
Diffstat (limited to 'weed/command/shell.go')
| -rw-r--r-- | weed/command/shell.go | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/weed/command/shell.go b/weed/command/shell.go index 91aa8770a..34b5aef31 100644 --- a/weed/command/shell.go +++ b/weed/command/shell.go @@ -2,9 +2,6 @@ package command import ( "fmt" - "net/url" - "strconv" - "strings" "github.com/chrislusf/seaweedfs/weed/security" "github.com/chrislusf/seaweedfs/weed/shell" @@ -37,7 +34,7 @@ func runShell(command *Command, args []string) bool { shellOptions.GrpcDialOption = security.LoadClientTLS(viper.Sub("grpc"), "client") var filerPwdErr error - shellOptions.FilerHost, shellOptions.FilerPort, shellOptions.Directory, filerPwdErr = parseFilerUrl(*shellInitialFilerUrl) + shellOptions.FilerHost, shellOptions.FilerPort, shellOptions.Directory, filerPwdErr = util.ParseFilerUrl(*shellInitialFilerUrl) if filerPwdErr != nil { fmt.Printf("failed to parse url filer.url=%s : %v\n", *shellInitialFilerUrl, filerPwdErr) return false @@ -48,22 +45,3 @@ func runShell(command *Command, args []string) bool { return true } - -func parseFilerUrl(entryPath string) (filerServer string, filerPort int64, path string, err error) { - if !strings.HasPrefix(entryPath, "http://") && !strings.HasPrefix(entryPath, "https://") { - entryPath = "http://" + entryPath - } - - var u *url.URL - u, err = url.Parse(entryPath) - if err != nil { - return - } - filerServer = u.Hostname() - portString := u.Port() - if portString != "" { - filerPort, err = strconv.ParseInt(portString, 10, 32) - } - path = u.Path - return -} |
