summaryrefslogtreecommitdiff
path: root/pkg/domain/entities
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-12-23 06:41:55 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-01-11 14:33:54 -0500
commit8f2358eeaa59fe369eebc6186403f95c2d66e49b (patch)
treea454ef259ab28f85b17f53b3273725480aa78515 /pkg/domain/entities
parentc4142ce0cfff792092bf420950b1985058cc241c (diff)
downloadpodman-8f2358eeaa59fe369eebc6186403f95c2d66e49b.tar.gz
podman-8f2358eeaa59fe369eebc6186403f95c2d66e49b.tar.bz2
podman-8f2358eeaa59fe369eebc6186403f95c2d66e49b.zip
Add podman rm --depend
This option causes Podman to not only remove the specified containers but all of the containers that depend on the specified containers. Fixes: https://github.com/containers/podman/issues/10360 Also ran codespell on the code Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain/entities')
-rw-r--r--pkg/domain/entities/containers.go6
-rw-r--r--pkg/domain/entities/engine_container.go2
-rw-r--r--pkg/domain/entities/reports/containers.go28
3 files changed, 30 insertions, 6 deletions
diff --git a/pkg/domain/entities/containers.go b/pkg/domain/entities/containers.go
index ae441b7f3..e3f8f1b7c 100644
--- a/pkg/domain/entities/containers.go
+++ b/pkg/domain/entities/containers.go
@@ -129,6 +129,7 @@ type RestartReport struct {
type RmOptions struct {
All bool
+ Depend bool
Force bool
Ignore bool
Latest bool
@@ -136,11 +137,6 @@ type RmOptions struct {
Volumes bool
}
-type RmReport struct {
- Err error
- Id string //nolint
-}
-
type ContainerInspectReport struct {
*define.InspectContainerData
}
diff --git a/pkg/domain/entities/engine_container.go b/pkg/domain/entities/engine_container.go
index 383e42098..7ce4dd0f6 100644
--- a/pkg/domain/entities/engine_container.go
+++ b/pkg/domain/entities/engine_container.go
@@ -40,7 +40,7 @@ type ContainerEngine interface {
ContainerRename(ctr context.Context, nameOrID string, options ContainerRenameOptions) error
ContainerRestart(ctx context.Context, namesOrIds []string, options RestartOptions) ([]*RestartReport, error)
ContainerRestore(ctx context.Context, namesOrIds []string, options RestoreOptions) ([]*RestoreReport, error)
- ContainerRm(ctx context.Context, namesOrIds []string, options RmOptions) ([]*RmReport, error)
+ ContainerRm(ctx context.Context, namesOrIds []string, options RmOptions) ([]*reports.RmReport, error)
ContainerRun(ctx context.Context, opts ContainerRunOptions) (*ContainerRunReport, error)
ContainerRunlabel(ctx context.Context, label string, image string, args []string, opts ContainerRunlabelOptions) error
ContainerStart(ctx context.Context, namesOrIds []string, options ContainerStartOptions) ([]*ContainerStartReport, error)
diff --git a/pkg/domain/entities/reports/containers.go b/pkg/domain/entities/reports/containers.go
new file mode 100644
index 000000000..54bcd092b
--- /dev/null
+++ b/pkg/domain/entities/reports/containers.go
@@ -0,0 +1,28 @@
+package reports
+
+type RmReport struct {
+ Id string `json:"Id"` //nolint
+ Err error `json:"Err,omitempty"`
+}
+
+func RmReportsIds(r []*RmReport) []string {
+ ids := make([]string, 0, len(r))
+ for _, v := range r {
+ if v == nil || v.Id == "" {
+ continue
+ }
+ ids = append(ids, v.Id)
+ }
+ return ids
+}
+
+func RmReportsErrs(r []*RmReport) []error {
+ errs := make([]error, 0, len(r))
+ for _, v := range r {
+ if v == nil || v.Err == nil {
+ continue
+ }
+ errs = append(errs, v.Err)
+ }
+ return errs
+}