summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-12-27 14:44:59 +0100
committerGitHub <noreply@github.com>2019-12-27 14:44:59 +0100
commit55922e36707347d5db7182cda3d820e4bd85968d (patch)
tree5dd5aa1f2d1ac038d28ad6261640436c1e461462
parentc759c3f78dcbbf5dec462a863ad25cd41a1707b7 (diff)
parent25860df8785c6d51ced8320ec6d0d9620171bdb9 (diff)
downloadpodman-55922e36707347d5db7182cda3d820e4bd85968d.tar.gz
podman-55922e36707347d5db7182cda3d820e4bd85968d.tar.bz2
podman-55922e36707347d5db7182cda3d820e4bd85968d.zip
Merge pull request #4751 from mheon/quiet_template_noconflict
The --quiet flag does not conflict with templates in ps
-rw-r--r--cmd/podman/ps.go12
-rw-r--r--test/e2e/ps_test.go15
2 files changed, 23 insertions, 4 deletions
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go
index 9fad0ea65..4ac779430 100644
--- a/cmd/podman/ps.go
+++ b/cmd/podman/ps.go
@@ -204,11 +204,15 @@ func checkFlagsPassed(c *cliconfig.PsValues) error {
if c.Last >= 0 && c.Latest {
return errors.Errorf("last and latest are mutually exclusive")
}
- // Quiet conflicts with size, namespace, and format with a Go template
+ // Quiet conflicts with size and namespace and is overridden by a Go
+ // template.
if c.Quiet {
- if c.Size || c.Namespace || (c.Flag("format").Changed &&
- c.Format != formats.JSONString) {
- return errors.Errorf("quiet conflicts with size, namespace, and format with go template")
+ if c.Size || c.Namespace {
+ return errors.Errorf("quiet conflicts with size and namespace")
+ }
+ if c.Flag("format").Changed && c.Format != formats.JSONString {
+ // Quiet is overridden by Go template output.
+ c.Quiet = false
}
}
// Size and namespace conflict with each other
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index a436d4f09..362c7aabb 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -361,4 +361,19 @@ var _ = Describe("Podman ps", func() {
Expect(len(output)).To(Equal(1))
Expect(output[0]).To(Equal(fullCid))
})
+
+ It("podman ps quiet template", func() {
+ ctrName := "testCtr"
+ session := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"ps", "-q", "-a", "--format", "{{ .Names }}"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+
+ output := result.OutputToStringArray()
+ Expect(len(output)).To(Equal(1))
+ Expect(output[0]).To(Equal(ctrName))
+ })
})