1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #23934 from cpuguy83/23862_fix_bind_opts

Fix panic due to nil bind options
This commit is contained in:
Alexander Morozov 2016-06-24 16:17:38 -07:00 committed by GitHub
commit b2ba44b11d

View file

@ -160,6 +160,13 @@ func (m *MountOpt) Set(value string) error {
return mount.VolumeOptions
}
bindOptions := func() *swarm.BindOptions {
if mount.BindOptions == nil {
mount.BindOptions = new(swarm.BindOptions)
}
return mount.BindOptions
}
setValueOnMap := func(target map[string]string, value string) {
parts := strings.SplitN(value, "=", 2)
if len(parts) == 1 {
@ -194,7 +201,7 @@ func (m *MountOpt) Set(value string) error {
return fmt.Errorf("invalid value for writable: %s", value)
}
case "bind-propagation":
mount.BindOptions.Propagation = swarm.MountPropagation(strings.ToUpper(value))
bindOptions().Propagation = swarm.MountPropagation(strings.ToUpper(value))
case "volume-populate":
volumeOptions().Populate, err = strconv.ParseBool(value)
if err != nil {