commit
519c4f0bd7
4 changed files with 14 additions and 8 deletions
|
@ -75,9 +75,11 @@ func (geesefs *geesefsMounter) MountDirect(target string, args []string) error {
|
||||||
"-o", "allow_other",
|
"-o", "allow_other",
|
||||||
"--log-file", "/dev/stderr",
|
"--log-file", "/dev/stderr",
|
||||||
}, args...)
|
}, args...)
|
||||||
os.Setenv("AWS_ACCESS_KEY_ID", geesefs.accessKeyID)
|
envs := []string{
|
||||||
os.Setenv("AWS_SECRET_ACCESS_KEY", geesefs.secretAccessKey)
|
"AWS_ACCESS_KEY_ID=" + geesefs.accessKeyID,
|
||||||
return fuseMount(target, geesefsCmd, args)
|
"AWS_SECRET_ACCESS_KEY=" + geesefs.secretAccessKey,
|
||||||
|
}
|
||||||
|
return fuseMount(target, geesefsCmd, args, envs)
|
||||||
}
|
}
|
||||||
|
|
||||||
type execCmd struct {
|
type execCmd struct {
|
||||||
|
|
|
@ -57,9 +57,11 @@ func New(meta *s3.FSMeta, cfg *s3.Config) (Mounter, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fuseMount(path string, command string, args []string) error {
|
func fuseMount(path string, command string, args []string, envs []string) error {
|
||||||
cmd := exec.Command(command, args...)
|
cmd := exec.Command(command, args...)
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
// cmd.Environ() returns envs inherited from the current process
|
||||||
|
cmd.Env = append(cmd.Environ(), envs...)
|
||||||
glog.V(3).Infof("Mounting fuse with command: %s and args: %s", command, args)
|
glog.V(3).Infof("Mounting fuse with command: %s and args: %s", command, args)
|
||||||
|
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
|
|
|
@ -47,7 +47,9 @@ func (rclone *rcloneMounter) Mount(target, volumeID string) error {
|
||||||
args = append(args, fmt.Sprintf("--s3-region=%s", rclone.region))
|
args = append(args, fmt.Sprintf("--s3-region=%s", rclone.region))
|
||||||
}
|
}
|
||||||
args = append(args, rclone.meta.MountOptions...)
|
args = append(args, rclone.meta.MountOptions...)
|
||||||
os.Setenv("AWS_ACCESS_KEY_ID", rclone.accessKeyID)
|
envs := []string{
|
||||||
os.Setenv("AWS_SECRET_ACCESS_KEY", rclone.secretAccessKey)
|
"AWS_ACCESS_KEY_ID=" + rclone.accessKeyID,
|
||||||
return fuseMount(target, rcloneCmd, args)
|
"AWS_SECRET_ACCESS_KEY=" + rclone.secretAccessKey,
|
||||||
|
}
|
||||||
|
return fuseMount(target, rcloneCmd, args, envs)
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ func (s3fs *s3fsMounter) Mount(target, volumeID string) error {
|
||||||
args = append(args, "-o", fmt.Sprintf("endpoint=%s", s3fs.region))
|
args = append(args, "-o", fmt.Sprintf("endpoint=%s", s3fs.region))
|
||||||
}
|
}
|
||||||
args = append(args, s3fs.meta.MountOptions...)
|
args = append(args, s3fs.meta.MountOptions...)
|
||||||
return fuseMount(target, s3fsCmd, args)
|
return fuseMount(target, s3fsCmd, args, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func writes3fsPass(pwFileContent string) error {
|
func writes3fsPass(pwFileContent string) error {
|
||||||
|
|
Loading…
Reference in a new issue