Skip to content

Commit 4510c4b

Browse files
committed
podman logs: allow options after argument
Do not use the interspersed option for logs, it is not needed and just restricts valid use cases. Fixes containers#25653 Signed-off-by: Paul Holzinger <[email protected]>
1 parent 3e42d5d commit 4510c4b

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

cmd/podman/containers/logs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ func logsFlags(cmd *cobra.Command) {
118118
flags.BoolVarP(&logsOptions.Colors, "color", "", false, "Output the containers with different colors in the log.")
119119
flags.BoolVarP(&logsOptions.Names, "names", "n", false, "Output the container name in the log")
120120

121-
flags.SetInterspersed(false)
122121
_ = flags.MarkHidden("details")
123122
}
124123

cmd/podman/pods/logs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ func logsFlags(cmd *cobra.Command) {
9292
flags.BoolVarP(&logsPodOptions.Timestamps, "timestamps", "t", false, "Output the timestamps in the log")
9393
flags.BoolVarP(&logsPodOptions.Colors, "color", "", false, "Output the containers within a pod with different colors in the log")
9494

95-
flags.SetInterspersed(false)
9695
_ = flags.MarkHidden("details")
9796
}
9897

test/e2e/logs_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ var _ = Describe("Podman logs", func() {
122122
Expect(wait).To(ExitCleanly())
123123

124124
Eventually(func(g Gomega) {
125-
results := podmanTest.Podman([]string{"logs", "--tail", "99", name})
125+
// Options after name should work as well
126+
// https: //github.com/containers/podman/issues/25653
127+
results := podmanTest.Podman([]string{"logs", name, "--tail", "99"})
126128
results.WaitWithDefaultTimeout()
127129
g.Expect(results).To(ExitCleanly())
128130
g.Expect(results.OutputToStringArray()).To(HaveLen(3))

test/system/035-logs.bats

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ function _log_test_follow_since() {
341341
sleep 0.2
342342

343343
# Make sure podman logs actually follows by giving a low timeout and check that the command times out
344-
PODMAN_TIMEOUT=3 run_podman 124 ${events_backend} logs --since 0.1s -f $cname
344+
# Option after container name should work as well: https://github.com/containers/podman/issues/25653
345+
PODMAN_TIMEOUT=3 run_podman 124 ${events_backend} logs --since 0.1s $cname -f
345346
assert "$output" =~ "$content
346347
timeout: sending signal TERM to command.*" "logs --since -f on running container works"
347348

0 commit comments

Comments
 (0)