(volumeName string, force bool)
| 10 | ) |
| 11 | |
| 12 | func NewDockerVolumeRemoveExecutor(volumeName string, force bool) common.Executor { |
| 13 | return func(ctx context.Context) error { |
| 14 | cli, err := GetDockerClient(ctx) |
| 15 | if err != nil { |
| 16 | return err |
| 17 | } |
| 18 | defer cli.Close() |
| 19 | |
| 20 | list, err := cli.VolumeList(ctx, client.VolumeListOptions{}) |
| 21 | if err != nil { |
| 22 | return err |
| 23 | } |
| 24 | |
| 25 | for _, vol := range list.Items { |
| 26 | if vol.Name == volumeName { |
| 27 | return removeExecutor(volumeName, force)(ctx) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | // Volume not found - do nothing |
| 32 | return nil |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | func removeExecutor(volume string, force bool) common.Executor { |
| 37 | return func(ctx context.Context) error { |
no test coverage detected
searching dependent graphs…