summaryrefslogtreecommitdiff
path: root/pkg/domain
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-05-23 12:16:49 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2022-05-23 12:16:54 -0400
commit5d37d80ff9783b2c811a06d80cd06fd6e338faf0 (patch)
tree3efc472f3dde96ce2ce43992bc45fa31d9f805cf /pkg/domain
parent7d00b0ea0d0c53ddba8d6aebdbce2f167aceccc5 (diff)
downloadpodman-5d37d80ff9783b2c811a06d80cd06fd6e338faf0.tar.gz
podman-5d37d80ff9783b2c811a06d80cd06fd6e338faf0.tar.bz2
podman-5d37d80ff9783b2c811a06d80cd06fd6e338faf0.zip
Use containers/common/pkg/util.StringToSlice
[NO NEW TESTS NEEDED] Just code cleanup for better reuse Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain')
-rw-r--r--pkg/domain/filters/containers.go3
-rw-r--r--pkg/domain/filters/pods.go7
-rw-r--r--pkg/domain/infra/abi/network.go2
-rw-r--r--pkg/domain/infra/abi/system.go3
4 files changed, 9 insertions, 6 deletions
diff --git a/pkg/domain/filters/containers.go b/pkg/domain/filters/containers.go
index 3e5b9cad9..e2ab8d70c 100644
--- a/pkg/domain/filters/containers.go
+++ b/pkg/domain/filters/containers.go
@@ -6,6 +6,7 @@ import (
"strings"
"time"
+ cutil "github.com/containers/common/pkg/util"
"github.com/containers/podman/v4/libpod"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/util"
@@ -257,7 +258,7 @@ func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpo
return false
}
for _, net := range networks {
- if util.StringInSlice(net, inputNetNames) {
+ if cutil.StringInSlice(net, inputNetNames) {
return true
}
}
diff --git a/pkg/domain/filters/pods.go b/pkg/domain/filters/pods.go
index e22480006..c2ed359f5 100644
--- a/pkg/domain/filters/pods.go
+++ b/pkg/domain/filters/pods.go
@@ -4,6 +4,7 @@ import (
"strconv"
"strings"
+ cutil "github.com/containers/common/pkg/util"
"github.com/containers/podman/v4/libpod"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/util"
@@ -57,7 +58,7 @@ func GeneratePodFilterFunc(filter string, filterValues []string, r *libpod.Runti
}, nil
case "ctr-status":
for _, filterValue := range filterValues {
- if !util.StringInSlice(filterValue, []string{"created", "running", "paused", "stopped", "exited", "unknown"}) {
+ if !cutil.StringInSlice(filterValue, []string{"created", "running", "paused", "stopped", "exited", "unknown"}) {
return nil, errors.Errorf("%s is not a valid status", filterValue)
}
}
@@ -94,7 +95,7 @@ func GeneratePodFilterFunc(filter string, filterValues []string, r *libpod.Runti
}, nil
case "status":
for _, filterValue := range filterValues {
- if !util.StringInSlice(filterValue, []string{"stopped", "running", "paused", "exited", "dead", "created", "degraded"}) {
+ if !cutil.StringInSlice(filterValue, []string{"stopped", "running", "paused", "exited", "dead", "created", "degraded"}) {
return nil, errors.Errorf("%s is not a valid pod status", filterValue)
}
}
@@ -150,7 +151,7 @@ func GeneratePodFilterFunc(filter string, filterValues []string, r *libpod.Runti
return false
}
for _, net := range networks {
- if util.StringInSlice(net, inputNetNames) {
+ if cutil.StringInSlice(net, inputNetNames) {
return true
}
}
diff --git a/pkg/domain/infra/abi/network.go b/pkg/domain/infra/abi/network.go
index 910008fc7..47f7917f4 100644
--- a/pkg/domain/infra/abi/network.go
+++ b/pkg/domain/infra/abi/network.go
@@ -5,9 +5,9 @@ import (
"github.com/containers/common/libnetwork/types"
netutil "github.com/containers/common/libnetwork/util"
+ "github.com/containers/common/pkg/util"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/domain/entities"
- "github.com/containers/podman/v4/pkg/util"
"github.com/pkg/errors"
)
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index 10f3e70b1..2ce190464 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -10,6 +10,7 @@ import (
"github.com/containers/common/pkg/cgroups"
"github.com/containers/common/pkg/config"
+ cutil "github.com/containers/common/pkg/util"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/domain/entities/reports"
@@ -307,7 +308,7 @@ func (ic *ContainerEngine) SystemDf(ctx context.Context, options entities.System
reclaimableSize += volSize
}
for _, viu := range inUse {
- if util.StringInSlice(viu, runningContainers) {
+ if cutil.StringInSlice(viu, runningContainers) {
consInUse++
}
}