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

Commit

Permalink
Merge pull request #18 from koenlek/add_allow_others_opt
Browse files Browse the repository at this point in the history
Add allow_other option. Also, make error on unknown options more clear.
  • Loading branch information
vieux authored Aug 14, 2017
2 parents 37d1428 + ff9df23 commit bb06429
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ docker plugin install vieux/sshfs # or docker plugin install vieux/sshfs DEBUG
2 - Create a volume

```
$ docker volume create -d vieux/sshfs -o sshcmd=<user@host:path> -o password=<password> [-o port=<port>] sshvolume
$ docker volume create -d vieux/sshfs -o sshcmd=<user@host:path> -o password=<password> [-o port=<port>] [-o allow_other] sshvolume
sshvolume
$ docker volume ls
DRIVER VOLUME NAME
Expand Down
16 changes: 11 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
const socketAddress = "/run/docker/plugins/sshfs.sock"

type sshfsVolume struct {
Password string
Sshcmd string
Port string
Password string
Sshcmd string
Port string
AllowOther bool

Mountpoint string
connections int
Expand Down Expand Up @@ -88,8 +89,10 @@ func (d *sshfsDriver) Create(r volume.Request) volume.Response {
v.Password = val
case "port":
v.Port = val
case "allow_other":
v.AllowOther = true
default:
return responseError(fmt.Sprintf("unknown option %q", val))
return responseError(fmt.Sprintf("unknown option %q=%q", key, val))
}
}

Expand Down Expand Up @@ -237,9 +240,12 @@ func (d *sshfsDriver) mountVolume(v *sshfsVolume) error {
cmd.Args = append(cmd.Args, "-p", v.Port)
}
if v.Password != "" {
cmd.Args = append(cmd.Args, "-p", v.Port, "-o", "workaround=rename", "-o", "password_stdin")
cmd.Args = append(cmd.Args, "-o", "workaround=rename", "-o", "password_stdin")
cmd.Stdin = strings.NewReader(v.Password)
}
if v.AllowOther {
cmd.Args = append(cmd.Args, "-o", "allow_other")
}
logrus.Debug(cmd.Args)
return cmd.Run()
}
Expand Down

0 comments on commit bb06429

Please sign in to comment.