aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_remote_mount.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-08-31 01:07:19 -0700
committerChris Lu <chris.lu@gmail.com>2021-08-31 01:07:19 -0700
commitc9205458a16bde4de8f8bc40b448a216888a1041 (patch)
tree42405f231ca0b05ba813a4f7df5c940040034705 /weed/shell/command_remote_mount.go
parent1dfcdc53b79672cae04942efa81267806227f298 (diff)
downloadseaweedfs-c9205458a16bde4de8f8bc40b448a216888a1041.tar.xz
seaweedfs-c9205458a16bde4de8f8bc40b448a216888a1041.zip
cloud drive: create mount directory if not exists
Diffstat (limited to 'weed/shell/command_remote_mount.go')
-rw-r--r--weed/shell/command_remote_mount.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/weed/shell/command_remote_mount.go b/weed/shell/command_remote_mount.go
index 3e92428d9..687098bff 100644
--- a/weed/shell/command_remote_mount.go
+++ b/weed/shell/command_remote_mount.go
@@ -12,7 +12,9 @@ import (
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
"io"
+ "os"
"strings"
+ "time"
)
func init() {
@@ -129,7 +131,19 @@ func (c *commandRemoteMount) syncMetadata(commandEnv *CommandEnv, writer io.Writ
})
if lookupErr != nil {
if !strings.Contains(lookupErr.Error(), filer_pb.ErrNotFound.Error()) {
- return fmt.Errorf("lookup %s: %v", dir, lookupErr)
+ _, createErr := client.CreateEntry(context.Background(), &filer_pb.CreateEntryRequest{
+ Directory: parent,
+ Entry: &filer_pb.Entry{
+ Name: name,
+ IsDirectory: true,
+ Attributes: &filer_pb.FuseAttributes{
+ Mtime: time.Now().Unix(),
+ Crtime: time.Now().Unix(),
+ FileMode: uint32(0644 | os.ModeDir),
+ },
+ },
+ })
+ return createErr
}
}