(ctx context.Context, keep string)
| 397 | } |
| 398 | |
| 399 | func (a *Application) removeContainersExcept(ctx context.Context, keep string) error { |
| 400 | containers, err := a.namespace.client.ContainerList(ctx, container.ListOptions{All: true}) |
| 401 | if err != nil { |
| 402 | return err |
| 403 | } |
| 404 | |
| 405 | for _, c := range containers { |
| 406 | if len(c.Names) == 0 { |
| 407 | continue |
| 408 | } |
| 409 | name := strings.TrimPrefix(c.Names[0], "/") |
| 410 | if a.namespace.containerAppName(name) == a.Settings.Name && name != keep { |
| 411 | if err := a.namespace.client.ContainerRemove(ctx, c.ID, container.RemoveOptions{Force: true}); err != nil { |
| 412 | return err |
| 413 | } |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | return nil |
| 418 | } |
| 419 | |
| 420 | func (a *Application) volumeMounts(vol *ApplicationVolume) []mount.Mount { |
| 421 | var mounts []mount.Mount |
no test coverage detected