diff options
author | Karthik Elango <kelango@redhat.com> | 2022-07-27 10:43:06 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2022-08-10 16:46:05 -0400 |
commit | a6ea3325a08378c1b39a446647aa697b3bd31619 (patch) | |
tree | 711ed098fb0b5a999ac336c974534bbc5a819c04 /pkg/domain/infra/tunnel/helpers.go | |
parent | a19c5a2521bd2cbcfaf290f40a31cbb98a041aa7 (diff) | |
download | podman-a6ea3325a08378c1b39a446647aa697b3bd31619.tar.gz podman-a6ea3325a08378c1b39a446647aa697b3bd31619.tar.bz2 podman-a6ea3325a08378c1b39a446647aa697b3bd31619.zip |
start filter flag changes
Tying filtering logic for podman stop and start to same place in getContainersAndInputByContext() to reduce code redundancy
Signed-off-by: Karthik Elango <kelango@redhat.com>
Diffstat (limited to 'pkg/domain/infra/tunnel/helpers.go')
-rw-r--r-- | pkg/domain/infra/tunnel/helpers.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pkg/domain/infra/tunnel/helpers.go b/pkg/domain/infra/tunnel/helpers.go index 9ff1641f0..20ea07948 100644 --- a/pkg/domain/infra/tunnel/helpers.go +++ b/pkg/domain/infra/tunnel/helpers.go @@ -31,8 +31,17 @@ func getContainersAndInputByContext(contextWithConnection context.Context, all, rawInputs := []string{} switch { case len(filters) > 0: + namesOrIDs = nil for i := range allContainers { - namesOrIDs = append(namesOrIDs, allContainers[i].ID) + if len(namesOrIDs) > 0 { + for _, name := range namesOrIDs { + if name == allContainers[i].ID { + namesOrIDs = append(namesOrIDs, allContainers[i].ID) + } + } + } else { + namesOrIDs = append(namesOrIDs, allContainers[i].ID) + } } case all: for i := range allContainers { |