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 #25653

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-03-27 15:33:58 +01:00
parent eb993814c1
commit 4bea200b26
4 changed files with 5 additions and 4 deletions

View File

@ -118,7 +118,6 @@ func logsFlags(cmd *cobra.Command) {
flags.BoolVarP(&logsOptions.Colors, "color", "", false, "Output the containers with different colors in the log.")
flags.BoolVarP(&logsOptions.Names, "names", "n", false, "Output the container name in the log")
flags.SetInterspersed(false)
_ = flags.MarkHidden("details")
}

View File

@ -92,7 +92,6 @@ func logsFlags(cmd *cobra.Command) {
flags.BoolVarP(&logsPodOptions.Timestamps, "timestamps", "t", false, "Output the timestamps in the log")
flags.BoolVarP(&logsPodOptions.Colors, "color", "", false, "Output the containers within a pod with different colors in the log")
flags.SetInterspersed(false)
_ = flags.MarkHidden("details")
}

View File

@ -122,7 +122,9 @@ var _ = Describe("Podman logs", func() {
Expect(wait).To(ExitCleanly())
Eventually(func(g Gomega) {
results := podmanTest.Podman([]string{"logs", "--tail", "99", name})
// Options after name should work as well
// https://github.com/containers/podman/issues/25653
results := podmanTest.Podman([]string{"logs", name, "--tail", "99"})
results.WaitWithDefaultTimeout()
g.Expect(results).To(ExitCleanly())
g.Expect(results.OutputToStringArray()).To(HaveLen(3))

View File

@ -341,7 +341,8 @@ function _log_test_follow_since() {
sleep 0.2
# Make sure podman logs actually follows by giving a low timeout and check that the command times out
PODMAN_TIMEOUT=3 run_podman 124 ${events_backend} logs --since 0.1s -f $cname
# Option after container name should work as well: https://github.com/containers/podman/issues/25653
PODMAN_TIMEOUT=3 run_podman 124 ${events_backend} logs --since 0.1s $cname -f
assert "$output" =~ "$content
timeout: sending signal TERM to command.*" "logs --since -f on running container works"