From 6926824926021dc988992a6e56884f046c5227bd Mon Sep 17 00:00:00 2001 From: Koen Lekkerkerker Date: Mon, 6 Mar 2017 22:08:26 +0100 Subject: [PATCH 1/5] Add allow_other option. Also, make error on unknown options more clear. --- README.md | 2 +- main.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 280c5a4..af3833c 100644 --- a/README.md +++ b/README.md @@ -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= -o password= [-o port=] sshvolume +$ docker volume create -d vieux/sshfs -o sshcmd= -o password= [-o port=] [-o allow_other] sshvolume sshvolume $ docker volume ls DRIVER VOLUME NAME diff --git a/main.go b/main.go index a368314..df486bb 100644 --- a/main.go +++ b/main.go @@ -22,6 +22,7 @@ type sshfsVolume struct { Password string Sshcmd string Port string + AllowOther bool Mountpoint string connections int @@ -87,8 +88,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)) } } @@ -238,6 +241,9 @@ func (d *sshfsDriver) mountVolume(v *sshfsVolume) error { if v.Password != "" { cmd = fmt.Sprintf("echo %s | %s -o workaround=rename -o password_stdin", v.Password, cmd) } + if v.AllowOther { + cmd = fmt.Sprintf("%s -o allow_other", cmd) + } logrus.Debug(cmd) return exec.Command("sh", "-c", cmd).Run() } From de250898cf5fc18dfc177a3e37f3018a4e05cc75 Mon Sep 17 00:00:00 2001 From: Koen Lekkerkerker Date: Sun, 30 Apr 2017 22:56:22 +0200 Subject: [PATCH 2/5] Fix formatting --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index df486bb..e816ab9 100644 --- a/main.go +++ b/main.go @@ -19,10 +19,10 @@ import ( const socketAddress = "/run/docker/plugins/sshfs.sock" type sshfsVolume struct { - Password string - Sshcmd string - Port string - AllowOther bool + Password string + Sshcmd string + Port string + AllowOther bool Mountpoint string connections int From e4e38d9008c4136fa944b827662ab6da0ae1890c Mon Sep 17 00:00:00 2001 From: Koen Lekkerkerker Date: Sun, 30 Apr 2017 23:03:48 +0200 Subject: [PATCH 3/5] Made a small mistake in resolving the merge conflict --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index cdc457a..8b382ba 100644 --- a/main.go +++ b/main.go @@ -246,7 +246,7 @@ func (d *sshfsDriver) mountVolume(v *sshfsVolume) error { if v.AllowOther { cmd = fmt.Sprintf("%s -o allow_other", cmd) } - logrus.Debug(cmd) + logrus.Debug(cmd.Args) return cmd.Run() } From cb73e85f0ab89a5d7b62db3bfca3a0e5d7f30d0f Mon Sep 17 00:00:00 2001 From: Koen Lekkerkerker Date: Sun, 30 Apr 2017 23:40:26 +0200 Subject: [PATCH 4/5] After merging upstream, other of my code turned out to need some rewriting too --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 8b382ba..e5fb69f 100644 --- a/main.go +++ b/main.go @@ -244,7 +244,7 @@ func (d *sshfsDriver) mountVolume(v *sshfsVolume) error { cmd.Stdin = strings.NewReader(v.Password) } if v.AllowOther { - cmd = fmt.Sprintf("%s -o allow_other", cmd) + cmd.Args = append(cmd.Args, "-o", "allow_other") } logrus.Debug(cmd.Args) return cmd.Run() From ff9df23d7134b864bc57c055d257c7c09ac93c34 Mon Sep 17 00:00:00 2001 From: Koen Lekkerkerker Date: Sun, 16 Jul 2017 15:57:31 +0200 Subject: [PATCH 5/5] Fix nasty bug introduced in https://github.com/vieux/docker-volume-sshfs/pull/20 --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index e5fb69f..2bf8cd3 100644 --- a/main.go +++ b/main.go @@ -240,7 +240,7 @@ 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 {