summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-01-10 05:31:11 -0500
committerGitHub <noreply@github.com>2021-01-10 05:31:11 -0500
commitbc0fa658f7617454673f8e2faf9298bef2890ea0 (patch)
treee5eec82d1489e353c625907e9f6745c4c6dc6274 /cmd/podman
parent49db79e735acd2c693762eaff62680cd9a8cb60b (diff)
parent82bce7d906c5b5aa1d98782bed8d5e77637fc0ef (diff)
downloadpodman-bc0fa658f7617454673f8e2faf9298bef2890ea0.tar.gz
podman-bc0fa658f7617454673f8e2faf9298bef2890ea0.tar.bz2
podman-bc0fa658f7617454673f8e2faf9298bef2890ea0.zip
Merge pull request #8920 from Luap99/ps-network-filter
podman ps/pod ps add network filter and .Networks format placeholder
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/common/completion.go10
-rw-r--r--cmd/podman/containers/ps.go5
-rw-r--r--cmd/podman/pods/ps.go5
3 files changed, 16 insertions, 4 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index 83fe0723c..d01842998 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -982,9 +982,10 @@ func AutocompletePsFilters(cmd *cobra.Command, args []string, toComplete string)
return []string{define.HealthCheckHealthy,
define.HealthCheckUnhealthy}, cobra.ShellCompDirectiveNoFileComp
},
- "label=": nil,
- "exited=": nil,
- "until=": nil,
+ "network=": func(s string) ([]string, cobra.ShellCompDirective) { return getNetworks(cmd, s) },
+ "label=": nil,
+ "exited=": nil,
+ "until=": nil,
}
return completeKeyValues(toComplete, kv)
}
@@ -1004,7 +1005,8 @@ func AutocompletePodPsFilters(cmd *cobra.Command, args []string, toComplete stri
"ctr-status=": func(_ string) ([]string, cobra.ShellCompDirective) {
return containerStatuses, cobra.ShellCompDirectiveNoFileComp
},
- "label=": nil,
+ "network=": func(s string) ([]string, cobra.ShellCompDirective) { return getNetworks(cmd, s) },
+ "label=": nil,
}
return completeKeyValues(toComplete, kv)
}
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index 5d08e6163..d23771fc5 100644
--- a/cmd/podman/containers/ps.go
+++ b/cmd/podman/containers/ps.go
@@ -392,6 +392,11 @@ func (l psReporter) Names() string {
return l.ListContainer.Names[0]
}
+// Networks returns the container network names in string format
+func (l psReporter) Networks() string {
+ return strings.Join(l.ListContainer.Networks, ",")
+}
+
// Ports converts from Portmappings to the string form
// required by ps
func (l psReporter) Ports() string {
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index 99d324411..a27ab4859 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -191,6 +191,11 @@ func (l ListPodReporter) Labels() map[string]string {
return l.ListPodsReport.Labels
}
+// Networks returns the infra container network names in string format
+func (l ListPodReporter) Networks() string {
+ return strings.Join(l.ListPodsReport.Networks, ",")
+}
+
// NumberOfContainers returns an int representation for
// the number of containers belonging to the pod
func (l ListPodReporter) NumberOfContainers() int {