(volume composetypes.ServiceVolumeConfig)
| 92 | } |
| 93 | |
| 94 | func handleImageToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) { |
| 95 | result := createMountFromVolume(volume) |
| 96 | |
| 97 | if volume.Source == "" { |
| 98 | return mount.Mount{}, errors.New("invalid image source, source cannot be empty") |
| 99 | } |
| 100 | if volume.Volume != nil { |
| 101 | return mount.Mount{}, errors.New("volume options are incompatible with type image") |
| 102 | } |
| 103 | if volume.Bind != nil { |
| 104 | return mount.Mount{}, errors.New("bind options are incompatible with type image") |
| 105 | } |
| 106 | if volume.Tmpfs != nil { |
| 107 | return mount.Mount{}, errors.New("tmpfs options are incompatible with type image") |
| 108 | } |
| 109 | if volume.Cluster != nil { |
| 110 | return mount.Mount{}, errors.New("cluster options are incompatible with type image") |
| 111 | } |
| 112 | if volume.Image != nil { |
| 113 | result.ImageOptions = &mount.ImageOptions{ |
| 114 | Subpath: volume.Image.Subpath, |
| 115 | } |
| 116 | } |
| 117 | return result, nil |
| 118 | } |
| 119 | |
| 120 | func handleBindToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) { |
| 121 | result := createMountFromVolume(volume) |
no test coverage detected
searching dependent graphs…