diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-08-08 22:26:37 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-08-08 22:26:37 -0700 |
| commit | c0b12da4efbeb272d015c8cd51c1751d4f9abde7 (patch) | |
| tree | 9ab01b2ce70f2f224ada3f9a1d4e1484a3b63bd8 /weed/shell/command_remote_mount.go | |
| parent | 52fcce81c64348dccf706e52161cf3fcf71e1df8 (diff) | |
| download | seaweedfs-c0b12da4efbeb272d015c8cd51c1751d4f9abde7.tar.xz seaweedfs-c0b12da4efbeb272d015c8cd51c1751d4f9abde7.zip | |
shell: add filer.remote.unmount
Diffstat (limited to 'weed/shell/command_remote_mount.go')
| -rw-r--r-- | weed/shell/command_remote_mount.go | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/weed/shell/command_remote_mount.go b/weed/shell/command_remote_mount.go index 37b235a55..91f8de2e2 100644 --- a/weed/shell/command_remote_mount.go +++ b/weed/shell/command_remote_mount.go @@ -9,6 +9,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/remote_storage" "github.com/chrislusf/seaweedfs/weed/util" "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" "io" ) @@ -50,7 +51,8 @@ func (c *commandRemoteMount) Do(args []string, commandEnv *CommandEnv, writer io } if *dir == "" { - return c.listExistingRemoteStorageMounts(commandEnv, writer) + _, err = listExistingRemoteStorageMounts(commandEnv, writer) + return err } remoteStorageLocation := remote_storage.ParseLocation(*remote) @@ -75,24 +77,29 @@ func (c *commandRemoteMount) Do(args []string, commandEnv *CommandEnv, writer io return nil } -func (c *commandRemoteMount) listExistingRemoteStorageMounts(commandEnv *CommandEnv, writer io.Writer) (err error) { +func listExistingRemoteStorageMounts(commandEnv *CommandEnv, writer io.Writer) (mappings *filer_pb.RemoteStorageMapping, err error) { // read current mapping - mappings, readErr := filer.ReadMountMappings(commandEnv.option.GrpcDialOption, commandEnv.option.FilerAddress) - if readErr != nil { - return readErr + mappings, err = filer.ReadMountMappings(commandEnv.option.GrpcDialOption, commandEnv.option.FilerAddress) + if err != nil { + return mappings, err } + jsonPrintln(writer, mappings) + + return + +} + +func jsonPrintln(writer io.Writer, message proto.Message) error { m := jsonpb.Marshaler{ EmitDefaults: false, Indent: " ", } - err = m.Marshal(writer, mappings) + err := m.Marshal(writer, message) fmt.Fprintln(writer) - - return - + return err } func (c *commandRemoteMount) findRemoteStorageConfiguration(commandEnv *CommandEnv, writer io.Writer, remote *filer_pb.RemoteStorageLocation) (conf *filer_pb.RemoteConf, err error) { |
