mirror of https://github.com/docker/docs.git
Change mount-types to lowercase
these values were changed to lowercase in
690cb2d08c
,
but not changed accordingly in docker/docker.
this changes the mounttypes to lowercase
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8f93128cd619e1d11be1bc0ae21f1362b1e3f9ad)
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
33a8310bc8
commit
4d7d354cff
|
@ -196,7 +196,7 @@ func (m *MountOpt) Set(value string) error {
|
||||||
key, value := parts[0], parts[1]
|
key, value := parts[0], parts[1]
|
||||||
switch strings.ToLower(key) {
|
switch strings.ToLower(key) {
|
||||||
case "type":
|
case "type":
|
||||||
mount.Type = swarm.MountType(strings.ToUpper(value))
|
mount.Type = swarm.MountType(strings.ToLower(value))
|
||||||
case "source":
|
case "source":
|
||||||
mount.Source = value
|
mount.Source = value
|
||||||
case "target":
|
case "target":
|
||||||
|
@ -208,7 +208,7 @@ func (m *MountOpt) Set(value string) error {
|
||||||
}
|
}
|
||||||
mount.ReadOnly = ro
|
mount.ReadOnly = ro
|
||||||
case "bind-propagation":
|
case "bind-propagation":
|
||||||
bindOptions().Propagation = swarm.MountPropagation(strings.ToUpper(value))
|
bindOptions().Propagation = swarm.MountPropagation(strings.ToLower(value))
|
||||||
case "volume-nocopy":
|
case "volume-nocopy":
|
||||||
volumeOptions().NoCopy, err = strconv.ParseBool(value)
|
volumeOptions().NoCopy, err = strconv.ParseBool(value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -240,10 +240,10 @@ func (m *MountOpt) Set(value string) error {
|
||||||
return fmt.Errorf("source is required when specifying volume-* options")
|
return fmt.Errorf("source is required when specifying volume-* options")
|
||||||
}
|
}
|
||||||
|
|
||||||
if mount.Type == swarm.MountType("BIND") && mount.VolumeOptions != nil {
|
if mount.Type == swarm.MountTypeBind && mount.VolumeOptions != nil {
|
||||||
return fmt.Errorf("cannot mix 'volume-*' options with mount type '%s'", swarm.MountTypeBind)
|
return fmt.Errorf("cannot mix 'volume-*' options with mount type '%s'", swarm.MountTypeBind)
|
||||||
}
|
}
|
||||||
if mount.Type == swarm.MountType("VOLUME") && mount.BindOptions != nil {
|
if mount.Type == swarm.MountTypeVolume && mount.BindOptions != nil {
|
||||||
return fmt.Errorf("cannot mix 'bind-*' options with mount type '%s'", swarm.MountTypeVolume)
|
return fmt.Errorf("cannot mix 'bind-*' options with mount type '%s'", swarm.MountTypeVolume)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,18 +61,18 @@ func TestMountOptString(t *testing.T) {
|
||||||
mount := MountOpt{
|
mount := MountOpt{
|
||||||
values: []swarm.Mount{
|
values: []swarm.Mount{
|
||||||
{
|
{
|
||||||
Type: swarm.MountType("BIND"),
|
Type: swarm.MountTypeBind,
|
||||||
Source: "/home/path",
|
Source: "/home/path",
|
||||||
Target: "/target",
|
Target: "/target",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Type: swarm.MountType("VOLUME"),
|
Type: swarm.MountTypeVolume,
|
||||||
Source: "foo",
|
Source: "foo",
|
||||||
Target: "/target/foo",
|
Target: "/target/foo",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
expected := "BIND /home/path /target, VOLUME foo /target/foo"
|
expected := "bind /home/path /target, volume foo /target/foo"
|
||||||
assert.Equal(t, mount.String(), expected)
|
assert.Equal(t, mount.String(), expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ func TestMountOptSetNoError(t *testing.T) {
|
||||||
mounts := mount.Value()
|
mounts := mount.Value()
|
||||||
assert.Equal(t, len(mounts), 1)
|
assert.Equal(t, len(mounts), 1)
|
||||||
assert.Equal(t, mounts[0], swarm.Mount{
|
assert.Equal(t, mounts[0], swarm.Mount{
|
||||||
Type: swarm.MountType("BIND"),
|
Type: swarm.MountTypeBind,
|
||||||
Source: "/foo",
|
Source: "/foo",
|
||||||
Target: "/target",
|
Target: "/target",
|
||||||
})
|
})
|
||||||
|
@ -96,22 +96,22 @@ func TestMountOptSetErrorNoType(t *testing.T) {
|
||||||
|
|
||||||
func TestMountOptSetErrorNoTarget(t *testing.T) {
|
func TestMountOptSetErrorNoTarget(t *testing.T) {
|
||||||
var mount MountOpt
|
var mount MountOpt
|
||||||
assert.Error(t, mount.Set("type=VOLUME,source=/foo"), "target is required")
|
assert.Error(t, mount.Set("type=volume,source=/foo"), "target is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMountOptSetErrorInvalidKey(t *testing.T) {
|
func TestMountOptSetErrorInvalidKey(t *testing.T) {
|
||||||
var mount MountOpt
|
var mount MountOpt
|
||||||
assert.Error(t, mount.Set("type=VOLUME,bogus=foo"), "unexpected key 'bogus'")
|
assert.Error(t, mount.Set("type=volume,bogus=foo"), "unexpected key 'bogus'")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMountOptSetErrorInvalidField(t *testing.T) {
|
func TestMountOptSetErrorInvalidField(t *testing.T) {
|
||||||
var mount MountOpt
|
var mount MountOpt
|
||||||
assert.Error(t, mount.Set("type=VOLUME,bogus"), "invalid field 'bogus'")
|
assert.Error(t, mount.Set("type=volume,bogus"), "invalid field 'bogus'")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMountOptSetErrorInvalidWritable(t *testing.T) {
|
func TestMountOptSetErrorInvalidWritable(t *testing.T) {
|
||||||
var mount MountOpt
|
var mount MountOpt
|
||||||
assert.Error(t, mount.Set("type=VOLUME,readonly=no"), "invalid value for readonly: no")
|
assert.Error(t, mount.Set("type=volume,readonly=no"), "invalid value for readonly: no")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMountOptDefaultEnableWritable(t *testing.T) {
|
func TestMountOptDefaultEnableWritable(t *testing.T) {
|
||||||
|
|
|
@ -90,8 +90,8 @@ func TestUpdateMounts(t *testing.T) {
|
||||||
flags.Set("mount-rm", "/toremove")
|
flags.Set("mount-rm", "/toremove")
|
||||||
|
|
||||||
mounts := []swarm.Mount{
|
mounts := []swarm.Mount{
|
||||||
{Target: "/toremove", Type: swarm.MountType("BIND")},
|
{Target: "/toremove", Type: swarm.MountTypeBind},
|
||||||
{Target: "/tokeep", Type: swarm.MountType("BIND")},
|
{Target: "/tokeep", Type: swarm.MountTypeBind},
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMounts(flags, &mounts)
|
updateMounts(flags, &mounts)
|
||||||
|
@ -122,7 +122,7 @@ func TestUpdatePorts(t *testing.T) {
|
||||||
flags.Set("publish-rm", "333/udp")
|
flags.Set("publish-rm", "333/udp")
|
||||||
|
|
||||||
portConfigs := []swarm.PortConfig{
|
portConfigs := []swarm.PortConfig{
|
||||||
{TargetPort: 333, Protocol: swarm.PortConfigProtocol("udp")},
|
{TargetPort: 333, Protocol: swarm.PortConfigProtocolUDP},
|
||||||
{TargetPort: 555},
|
{TargetPort: 555},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3936,7 +3936,7 @@ Create a service
|
||||||
"ReadOnly": true,
|
"ReadOnly": true,
|
||||||
"Source": "web-data",
|
"Source": "web-data",
|
||||||
"Target": "/usr/share/nginx/html",
|
"Target": "/usr/share/nginx/html",
|
||||||
"Type": "VOLUME",
|
"Type": "volume",
|
||||||
"VolumeOptions": {
|
"VolumeOptions": {
|
||||||
"DriverConfig": {
|
"DriverConfig": {
|
||||||
},
|
},
|
||||||
|
|
|
@ -143,12 +143,12 @@ func (m *MountPoint) Path() string {
|
||||||
// Type returns the type of mount point
|
// Type returns the type of mount point
|
||||||
func (m *MountPoint) Type() string {
|
func (m *MountPoint) Type() string {
|
||||||
if m.Name != "" {
|
if m.Name != "" {
|
||||||
return "VOLUME"
|
return "volume"
|
||||||
}
|
}
|
||||||
if m.Source != "" {
|
if m.Source != "" {
|
||||||
return "BIND"
|
return "bind"
|
||||||
}
|
}
|
||||||
return "EPHEMERAL"
|
return "ephemeral"
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseVolumesFrom ensures that the supplied volumes-from is valid.
|
// ParseVolumesFrom ensures that the supplied volumes-from is valid.
|
||||||
|
|
Loading…
Reference in New Issue