mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Remove extraneous mount aliases.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
b90f6d780a
commit
39a3700c01
2 changed files with 9 additions and 11 deletions
|
@ -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":
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue