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

Commit 4b0f599

Browse files
committed
passthrough any -o
1 parent f89b357 commit 4b0f599

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

main.go

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

2222
type sshfsVolume struct {
23-
Password string
24-
Sshcmd string
25-
Port string
26-
AllowOther bool
23+
Password string
24+
Sshcmd string
25+
Port string
26+
27+
Options []string
2728

2829
Mountpoint string
2930
connections int
@@ -89,10 +90,12 @@ func (d *sshfsDriver) Create(r *volume.CreateRequest) error {
8990
v.Password = val
9091
case "port":
9192
v.Port = val
92-
case "allow_other":
93-
v.AllowOther = true
9493
default:
95-
return logError("unknown option %q=%q", key, val)
94+
if val != "" {
95+
v.Options = append(v.Options, key+"="+val)
96+
} else {
97+
v.Options = append(v.Options, key)
98+
}
9699
}
97100
}
98101

@@ -243,9 +246,11 @@ func (d *sshfsDriver) mountVolume(v *sshfsVolume) error {
243246
cmd.Args = append(cmd.Args, "-o", "workaround=rename", "-o", "password_stdin")
244247
cmd.Stdin = strings.NewReader(v.Password)
245248
}
246-
if v.AllowOther {
247-
cmd.Args = append(cmd.Args, "-o", "allow_other")
249+
250+
for _, option := range v.Options {
251+
cmd.Args = append(cmd.Args, "-o", option)
248252
}
253+
249254
logrus.Debug(cmd.Args)
250255
return cmd.Run()
251256
}

0 commit comments

Comments
 (0)