summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Vass <tiborvass@users.noreply.github.com>2016-07-27 14:13:49 -0700
committerGitHub <noreply@github.com>2016-07-27 14:13:49 -0700
commitc9b38547d5f82041fa90a0b8a875bef74988681f (patch)
tree309d077ebd8d37108a4b80e52437a1773fc9b43b
parent340ff060a8e077b483fa6908c1c9bffacaa526b5 (diff)
parent398bde913f62793c51de6aab5a71ac1eed99c557 (diff)
downloaddocker-c9b38547d5f82041fa90a0b8a875bef74988681f.tar.gz
Merge pull request #25144 from dnephin/remove-extraneous-aliases.bump
[bump_v1.12.0] Remove extraneous mount aliases
-rw-r--r--api/client/service/opts.go16
-rw-r--r--api/client/service/opts_test.go4
2 files changed, 9 insertions, 11 deletions
diff --git a/api/client/service/opts.go b/api/client/service/opts.go
index 187c77f263..f32bd05d53 100644
--- a/api/client/service/opts.go
+++ b/api/client/service/opts.go
@@ -178,12 +178,11 @@ func (m *MountOpt) Set(value string) error {
key := strings.ToLower(parts[0])
if len(parts) == 1 {
- if key == "readonly" || key == "ro" {
+ switch key {
+ case "readonly", "ro":
mount.ReadOnly = true
continue
- }
-
- if key == "volume-nocopy" {
+ case "volume-nocopy":
volumeOptions().NoCopy = true
continue
}
@@ -197,16 +196,15 @@ func (m *MountOpt) Set(value string) error {
switch key {
case "type":
mount.Type = swarm.MountType(strings.ToLower(value))
- case "source", "name", "src":
+ case "source", "src":
mount.Source = value
- case "target", "dst", "dest", "destination", "path":
+ case "target", "dst", "destination":
mount.Target = value
case "readonly", "ro":
- ro, err := strconv.ParseBool(value)
+ mount.ReadOnly, err = strconv.ParseBool(value)
if err != nil {
- return fmt.Errorf("invalid value for readonly: %s", value)
+ return fmt.Errorf("invalid value for %s: %s", key, value)
}
- mount.ReadOnly = ro
case "bind-propagation":
bindOptions().Propagation = swarm.MountPropagation(strings.ToLower(value))
case "volume-nocopy":
diff --git a/api/client/service/opts_test.go b/api/client/service/opts_test.go
index 48f6acc921..c4d56c1ab6 100644
--- a/api/client/service/opts_test.go
+++ b/api/client/service/opts_test.go
@@ -81,8 +81,8 @@ func TestMountOptSetNoError(t *testing.T) {
// tests several aliases that should have same result.
"type=bind,target=/target,source=/source",
"type=bind,src=/source,dst=/target",
- "type=bind,name=/source,dst=/target",
- "type=bind,name=/source,path=/target",
+ "type=bind,source=/source,dst=/target",
+ "type=bind,src=/source,target=/target",
} {
var mount MountOpt