Loading pkg/mounter/goofys.go +8 −34 Original line number Diff line number Diff line Loading @@ -4,12 +4,8 @@ import ( "fmt" "os" "path" "strings" "context" "github.com/ctrox/csi-s3/pkg/s3" goofysApi "github.com/kahing/goofys/api" ) const ( Loading Loading @@ -50,37 +46,15 @@ func (goofys *goofysMounter) Unstage(stageTarget string) error { } func (goofys *goofysMounter) Mount(source string, target string) error { mountOptions := make(map[string]string) for _, opt := range goofys.meta.MountOptions { s := 0 if len(opt) >= 2 && opt[0] == '-' && opt[1] == byte('-') { s = 2 } p := strings.Index(opt, "=") if p > 0 { mountOptions[string(opt[s : p])] = string(opt[p : ]) } else { mountOptions[string(opt[s : ])] = "" } } mountOptions["allow_other"] = "" goofysCfg := &goofysApi.Config{ MountPoint: target, Endpoint: goofys.endpoint, Region: goofys.region, DirMode: 0755, FileMode: 0644, MountOptions: mountOptions, fullPath := fmt.Sprintf("%s:%s", goofys.meta.BucketName, path.Join(goofys.meta.Prefix, goofys.meta.FSPath)) args := []string{ "--endpoint", goofys.endpoint, "--region", goofys.region, "-o", "allow_other", fullPath, target, } args = append(args, goofys.meta.MountOptions...) os.Setenv("AWS_ACCESS_KEY_ID", goofys.accessKeyID) os.Setenv("AWS_SECRET_ACCESS_KEY", goofys.secretAccessKey) fullPath := fmt.Sprintf("%s:%s", goofys.meta.BucketName, path.Join(goofys.meta.Prefix, goofys.meta.FSPath)) _, _, err := goofysApi.Mount(context.Background(), fullPath, goofysCfg) if err != nil { return fmt.Errorf("Error mounting via goofys: %s", err) } return nil return fuseMount(target, goofysCmd, args) } Loading
pkg/mounter/goofys.go +8 −34 Original line number Diff line number Diff line Loading @@ -4,12 +4,8 @@ import ( "fmt" "os" "path" "strings" "context" "github.com/ctrox/csi-s3/pkg/s3" goofysApi "github.com/kahing/goofys/api" ) const ( Loading Loading @@ -50,37 +46,15 @@ func (goofys *goofysMounter) Unstage(stageTarget string) error { } func (goofys *goofysMounter) Mount(source string, target string) error { mountOptions := make(map[string]string) for _, opt := range goofys.meta.MountOptions { s := 0 if len(opt) >= 2 && opt[0] == '-' && opt[1] == byte('-') { s = 2 } p := strings.Index(opt, "=") if p > 0 { mountOptions[string(opt[s : p])] = string(opt[p : ]) } else { mountOptions[string(opt[s : ])] = "" } } mountOptions["allow_other"] = "" goofysCfg := &goofysApi.Config{ MountPoint: target, Endpoint: goofys.endpoint, Region: goofys.region, DirMode: 0755, FileMode: 0644, MountOptions: mountOptions, fullPath := fmt.Sprintf("%s:%s", goofys.meta.BucketName, path.Join(goofys.meta.Prefix, goofys.meta.FSPath)) args := []string{ "--endpoint", goofys.endpoint, "--region", goofys.region, "-o", "allow_other", fullPath, target, } args = append(args, goofys.meta.MountOptions...) os.Setenv("AWS_ACCESS_KEY_ID", goofys.accessKeyID) os.Setenv("AWS_SECRET_ACCESS_KEY", goofys.secretAccessKey) fullPath := fmt.Sprintf("%s:%s", goofys.meta.BucketName, path.Join(goofys.meta.Prefix, goofys.meta.FSPath)) _, _, err := goofysApi.Mount(context.Background(), fullPath, goofysCfg) if err != nil { return fmt.Errorf("Error mounting via goofys: %s", err) } return nil return fuseMount(target, goofysCmd, args) }