Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

Commit bb06429

Browse files
authored
Merge pull request #18 from koenlek/add_allow_others_opt
Add allow_other option. Also, make error on unknown options more clear.
2 parents 37d1428 + ff9df23 commit bb06429

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $ docker plugin install vieux/sshfs # or docker plugin install vieux/sshfs DEBUG
1616
2 - Create a volume
1717

1818
```
19-
$ docker volume create -d vieux/sshfs -o sshcmd=<user@host:path> -o password=<password> [-o port=<port>] sshvolume
19+
$ docker volume create -d vieux/sshfs -o sshcmd=<user@host:path> -o password=<password> [-o port=<port>] [-o allow_other] sshvolume
2020
sshvolume
2121
$ docker volume ls
2222
DRIVER VOLUME NAME

main.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ import (
2020
const socketAddress = "/run/docker/plugins/sshfs.sock"
2121

2222
type sshfsVolume struct {
23-
Password string
24-
Sshcmd string
25-
Port string
23+
Password string
24+
Sshcmd string
25+
Port string
26+
AllowOther bool
2627

2728
Mountpoint string
2829
connections int
@@ -88,8 +89,10 @@ func (d *sshfsDriver) Create(r volume.Request) volume.Response {
8889
v.Password = val
8990
case "port":
9091
v.Port = val
92+
case "allow_other":
93+
v.AllowOther = true
9194
default:
92-
return responseError(fmt.Sprintf("unknown option %q", val))
95+
return responseError(fmt.Sprintf("unknown option %q=%q", key, val))
9396
}
9497
}
9598

@@ -237,9 +240,12 @@ func (d *sshfsDriver) mountVolume(v *sshfsVolume) error {
237240
cmd.Args = append(cmd.Args, "-p", v.Port)
238241
}
239242
if v.Password != "" {
240-
cmd.Args = append(cmd.Args, "-p", v.Port, "-o", "workaround=rename", "-o", "password_stdin")
243+
cmd.Args = append(cmd.Args, "-o", "workaround=rename", "-o", "password_stdin")
241244
cmd.Stdin = strings.NewReader(v.Password)
242245
}
246+
if v.AllowOther {
247+
cmd.Args = append(cmd.Args, "-o", "allow_other")
248+
}
243249
logrus.Debug(cmd.Args)
244250
return cmd.Run()
245251
}

0 commit comments

Comments
 (0)