mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
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:
@ -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.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.BoolVarP(&logsOptions.Names, "names", "n", false, "Output the container name in the log")
|
||||||
|
|
||||||
flags.SetInterspersed(false)
|
|
||||||
_ = flags.MarkHidden("details")
|
_ = flags.MarkHidden("details")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.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.BoolVarP(&logsPodOptions.Colors, "color", "", false, "Output the containers within a pod with different colors in the log")
|
||||||
|
|
||||||
flags.SetInterspersed(false)
|
|
||||||
_ = flags.MarkHidden("details")
|
_ = flags.MarkHidden("details")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,9 @@ var _ = Describe("Podman logs", func() {
|
|||||||
Expect(wait).To(ExitCleanly())
|
Expect(wait).To(ExitCleanly())
|
||||||
|
|
||||||
Eventually(func(g Gomega) {
|
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()
|
results.WaitWithDefaultTimeout()
|
||||||
g.Expect(results).To(ExitCleanly())
|
g.Expect(results).To(ExitCleanly())
|
||||||
g.Expect(results.OutputToStringArray()).To(HaveLen(3))
|
g.Expect(results.OutputToStringArray()).To(HaveLen(3))
|
||||||
|
@ -341,7 +341,8 @@ function _log_test_follow_since() {
|
|||||||
sleep 0.2
|
sleep 0.2
|
||||||
|
|
||||||
# Make sure podman logs actually follows by giving a low timeout and check that the command times out
|
# 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
|
assert "$output" =~ "$content
|
||||||
timeout: sending signal TERM to command.*" "logs --since -f on running container works"
|
timeout: sending signal TERM to command.*" "logs --since -f on running container works"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user