@@ -10,6 +10,7 @@ import (
1010
1111 "github.com/docker/docker/opts"
1212 runconfigopts "github.com/docker/docker/runconfig/opts"
13+ mounttypes "github.com/docker/engine-api/types/mount"
1314 "github.com/docker/engine-api/types/swarm"
1415 "github.com/docker/go-connections/nat"
1516 units "github.com/docker/go-units"
@@ -130,7 +131,7 @@ func (i *Uint64Opt) Value() *uint64 {
130131
131132// MountOpt is a Value type for parsing mounts
132133type MountOpt struct {
133- values []swarm .Mount
134+ values []mounttypes .Mount
134135}
135136
136137// Set a new mount value
@@ -141,23 +142,23 @@ func (m *MountOpt) Set(value string) error {
141142 return err
142143 }
143144
144- mount := swarm .Mount {}
145+ mount := mounttypes .Mount {}
145146
146- volumeOptions := func () * swarm .VolumeOptions {
147+ volumeOptions := func () * mounttypes .VolumeOptions {
147148 if mount .VolumeOptions == nil {
148- mount .VolumeOptions = & swarm .VolumeOptions {
149+ mount .VolumeOptions = & mounttypes .VolumeOptions {
149150 Labels : make (map [string ]string ),
150151 }
151152 }
152153 if mount .VolumeOptions .DriverConfig == nil {
153- mount .VolumeOptions .DriverConfig = & swarm .Driver {}
154+ mount .VolumeOptions .DriverConfig = & mounttypes .Driver {}
154155 }
155156 return mount .VolumeOptions
156157 }
157158
158- bindOptions := func () * swarm .BindOptions {
159+ bindOptions := func () * mounttypes .BindOptions {
159160 if mount .BindOptions == nil {
160- mount .BindOptions = new (swarm .BindOptions )
161+ mount .BindOptions = new (mounttypes .BindOptions )
161162 }
162163 return mount .BindOptions
163164 }
@@ -171,7 +172,7 @@ func (m *MountOpt) Set(value string) error {
171172 }
172173 }
173174
174- mount .Type = swarm . MountTypeVolume // default to volume mounts
175+ mount .Type = mounttypes . TypeVolume // default to volume mounts
175176 // Set writable as the default
176177 for _ , field := range fields {
177178 parts := strings .SplitN (field , "=" , 2 )
@@ -195,7 +196,7 @@ func (m *MountOpt) Set(value string) error {
195196 value := parts [1 ]
196197 switch key {
197198 case "type" :
198- mount .Type = swarm . MountType (strings .ToLower (value ))
199+ mount .Type = mounttypes . Type (strings .ToLower (value ))
199200 case "source" , "src" :
200201 mount .Source = value
201202 case "target" , "dst" , "destination" :
@@ -206,7 +207,7 @@ func (m *MountOpt) Set(value string) error {
206207 return fmt .Errorf ("invalid value for %s: %s" , key , value )
207208 }
208209 case "bind-propagation" :
209- bindOptions ().Propagation = swarm . MountPropagation (strings .ToLower (value ))
210+ bindOptions ().Propagation = mounttypes . Propagation (strings .ToLower (value ))
210211 case "volume-nocopy" :
211212 volumeOptions ().NoCopy , err = strconv .ParseBool (value )
212213 if err != nil {
@@ -238,11 +239,11 @@ func (m *MountOpt) Set(value string) error {
238239 return fmt .Errorf ("source is required when specifying volume-* options" )
239240 }
240241
241- if mount .Type == swarm . MountTypeBind && mount .VolumeOptions != nil {
242- return fmt .Errorf ("cannot mix 'volume-*' options with mount type '%s'" , swarm . MountTypeBind )
242+ if mount .Type == mounttypes . TypeBind && mount .VolumeOptions != nil {
243+ return fmt .Errorf ("cannot mix 'volume-*' options with mount type '%s'" , mounttypes . TypeBind )
243244 }
244- if mount .Type == swarm . MountTypeVolume && mount .BindOptions != nil {
245- return fmt .Errorf ("cannot mix 'bind-*' options with mount type '%s'" , swarm . MountTypeVolume )
245+ if mount .Type == mounttypes . TypeVolume && mount .BindOptions != nil {
246+ return fmt .Errorf ("cannot mix 'bind-*' options with mount type '%s'" , mounttypes . TypeVolume )
246247 }
247248
248249 m .values = append (m .values , mount )
@@ -265,7 +266,7 @@ func (m *MountOpt) String() string {
265266}
266267
267268// Value returns the mounts
268- func (m * MountOpt ) Value () []swarm .Mount {
269+ func (m * MountOpt ) Value () []mounttypes .Mount {
269270 return m .values
270271}
271272
0 commit comments