From ae9a2d26dff444ec946387c9bc9f74140806613e Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Fri, 11 Nov 2022 09:17:38 -0500 Subject: [PATCH 1/2] Fix search_test to return correct version of alpine Signed-off-by: Daniel J Walsh --- test/e2e/search_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go index 5d562aebdb..484a3c4d30 100644 --- a/test/e2e/search_test.go +++ b/test/e2e/search_test.go @@ -129,13 +129,13 @@ registries = ['{{.Host}}:{{.Port}}']` }) It("podman search format json list tags", func() { - search := podmanTest.Podman([]string{"search", "--list-tags", "--format", "json", "alpine"}) + search := podmanTest.Podman([]string{"search", "--list-tags", "--format", "json", ALPINE}) search.WaitWithDefaultTimeout() Expect(search).Should(Exit(0)) Expect(search.OutputToString()).To(BeValidJSON()) - Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/alpine")) - Expect(search.OutputToString()).To(ContainSubstring("3.10")) - Expect(search.OutputToString()).To(ContainSubstring("2.7")) + Expect(search.OutputToString()).To(ContainSubstring("quay.io/libpod/alpine")) + Expect(search.OutputToString()).To(ContainSubstring("3.10.2")) + Expect(search.OutputToString()).To(ContainSubstring("3.2")) }) // Test for https://github.com/containers/podman/issues/11894 From bc77c034f8f05f95f0d89f7fc91684bbebb288d1 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Wed, 9 Nov 2022 15:45:01 -0500 Subject: [PATCH 2/2] Add podman system events alias to podman events Signed-off-by: Daniel J Walsh --- cmd/podman/system/events.go | 33 +++++++++++++++---- commands-demo.md | 1 + .../markdown/links/podman-system-events.1 | 1 + docs/source/markdown/podman-events.1.md | 2 ++ docs/source/markdown/podman-system.1.md | 1 + test/system/090-events.bats | 2 +- test/system/610-format.bats | 1 + transfer.md | 1 + 8 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 docs/source/markdown/links/podman-system-events.1 diff --git a/cmd/podman/system/events.go b/cmd/podman/system/events.go index 290f5b0fa2..2614615097 100644 --- a/cmd/podman/system/events.go +++ b/cmd/podman/system/events.go @@ -16,13 +16,13 @@ import ( ) var ( - eventsDescription = `Monitor podman events. + eventsDescription = `Monitor podman system events. By default, streaming mode is used, printing new events as they occur. Previous events can be listed via --since and --until.` eventsCommand = &cobra.Command{ Use: "events [options]", Args: validate.NoArgs, - Short: "Show podman events", + Short: "Show podman system events", Long: eventsDescription, RunE: eventsCmd, ValidArgsFunction: completion.AutocompleteNone, @@ -31,6 +31,16 @@ var ( podman events --format {{.Image}} podman events --since 1h30s`, } + + systemEventsCommand = &cobra.Command{ + Args: eventsCommand.Args, + Use: eventsCommand.Use, + Short: eventsCommand.Short, + Long: eventsCommand.Long, + RunE: eventsCommand.RunE, + ValidArgsFunction: eventsCommand.ValidArgsFunction, + Example: `podman system events`, + } ) var ( @@ -40,30 +50,39 @@ var ( ) func init() { + registry.Commands = append(registry.Commands, registry.CliCommand{ + Command: systemEventsCommand, + Parent: systemCmd, + }) + eventsFlags(systemEventsCommand) registry.Commands = append(registry.Commands, registry.CliCommand{ Command: eventsCommand, }) - flags := eventsCommand.Flags() + eventsFlags(eventsCommand) +} + +func eventsFlags(cmd *cobra.Command) { + flags := cmd.Flags() filterFlagName := "filter" flags.StringArrayVarP(&eventOptions.Filter, filterFlagName, "f", []string{}, "filter output") - _ = eventsCommand.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteEventFilter) + _ = cmd.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteEventFilter) formatFlagName := "format" flags.StringVar(&eventFormat, formatFlagName, "", "format the output using a Go template") - _ = eventsCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&events.Event{})) + _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&events.Event{})) flags.BoolVar(&eventOptions.Stream, "stream", true, "stream new events; for testing only") sinceFlagName := "since" flags.StringVar(&eventOptions.Since, sinceFlagName, "", "show all events created since timestamp") - _ = eventsCommand.RegisterFlagCompletionFunc(sinceFlagName, completion.AutocompleteNone) + _ = cmd.RegisterFlagCompletionFunc(sinceFlagName, completion.AutocompleteNone) flags.BoolVar(&noTrunc, "no-trunc", true, "do not truncate the output") untilFlagName := "until" flags.StringVar(&eventOptions.Until, untilFlagName, "", "show all events until timestamp") - _ = eventsCommand.RegisterFlagCompletionFunc(untilFlagName, completion.AutocompleteNone) + _ = cmd.RegisterFlagCompletionFunc(untilFlagName, completion.AutocompleteNone) _ = flags.MarkHidden("stream") } diff --git a/commands-demo.md b/commands-demo.md index f3a1216a11..6ff670a31e 100644 --- a/commands-demo.md +++ b/commands-demo.md @@ -90,6 +90,7 @@ | [podman-stop(1)](https://podman.readthedocs.io/en/latest/markdown/podman-stop.1.html) | Stops one or more running containers | | [podman-system(1)](https://podman.readthedocs.io/en/latest/system.html) | Manage podman | | [podman-system-df(1)](https://podman.readthedocs.io/en/latest/markdown/podman-system-df.1.html) | Show podman disk usage. | +| [podman-system-events(1)](https://podman.readthedocs.io/en/latest/markdown/podman-events.1.html) | Displays Podman related system events. | | [podman-system-info(1)](https://podman.readthedocs.io/en/latest/markdown/podman-info.1.html) | Displays Podman related system information. | | [podman-system-migrate(1)](https://podman.readthedocs.io/en/latest/markdown/podman-system-migrate.1.html) | Migrate existing containers to a new podman version | | [podman-system-prune(1)](https://podman.readthedocs.io/en/latest/markdown/podman-system-prune.1.html) | Remove all unused container, image and volume data | diff --git a/docs/source/markdown/links/podman-system-events.1 b/docs/source/markdown/links/podman-system-events.1 new file mode 100644 index 0000000000..7eb4748c29 --- /dev/null +++ b/docs/source/markdown/links/podman-system-events.1 @@ -0,0 +1 @@ +.so man1/podman-events.1 diff --git a/docs/source/markdown/podman-events.1.md b/docs/source/markdown/podman-events.1.md index dd62ef5a21..97fc61f126 100644 --- a/docs/source/markdown/podman-events.1.md +++ b/docs/source/markdown/podman-events.1.md @@ -6,6 +6,8 @@ podman\-events - Monitor Podman events ## SYNOPSIS **podman events** [*options*] +**podman system events** [*options*] + ## DESCRIPTION Monitor and print events that occur in Podman. Each event will include a timestamp, diff --git a/docs/source/markdown/podman-system.1.md b/docs/source/markdown/podman-system.1.md index 0a9ef4f495..e7ef5da307 100644 --- a/docs/source/markdown/podman-system.1.md +++ b/docs/source/markdown/podman-system.1.md @@ -15,6 +15,7 @@ The system command allows you to manage the podman systems | ------- | ------------------------------------------------------------ | ------------------------------------------------------------------------ | | connection | [podman-system-connection(1)](podman-system-connection.1.md) | Manage the destination(s) for Podman service(s) | | df | [podman-system-df(1)](podman-system-df.1.md) | Show podman disk usage. | +| events | [podman-system-events(1)](podman-events.1.md) | Monitor Podman events | | info | [podman-system-info(1)](podman-info.1.md) | Displays Podman related system information. | | migrate | [podman-system-migrate(1)](podman-system-migrate.1.md) | Migrate existing containers to a new podman version. | | prune | [podman-system-prune(1)](podman-system-prune.1.md) | Remove all unused pods, containers, images, networks, and volume data. | diff --git a/test/system/090-events.bats b/test/system/090-events.bats index 90b9b3b9c8..4ec13eeb7c 100644 --- a/test/system/090-events.bats +++ b/test/system/090-events.bats @@ -17,7 +17,7 @@ load helpers is "$output" "$expect" "filtering by container name and label" # Same thing, but without the container-name filter - run_podman events -f type=container --filter label=${labelname}=${labelvalue} --filter event=start --stream=false + run_podman system events -f type=container --filter label=${labelname}=${labelvalue} --filter event=start --stream=false is "$output" "$expect" "filtering just by label" # Now filter just by container name, no label diff --git a/test/system/610-format.bats b/test/system/610-format.bats index 8f74634d10..3ee95bdff3 100644 --- a/test/system/610-format.bats +++ b/test/system/610-format.bats @@ -37,6 +37,7 @@ search | $IMAGE pod inspect | mypod events | --stream=false --events-backend=file +system events | --stream=false --events-backend=file " # podman machine is finicky. Assume we can't run it, but see below for more. diff --git a/transfer.md b/transfer.md index c755a761f4..e1bceb2aff 100644 --- a/transfer.md +++ b/transfer.md @@ -87,6 +87,7 @@ There are other equivalents for these tools | `docker stop` | [`podman stop`](./docs/source/markdown/podman-stop.1.md) | | `docker system ` | [`podman system`](./docs/source/markdown/podman-system.1.md) | | `docker system df` | [`podman system df`](./docs/source/markdown/podman-system-df.1.md) | +| `docker system events` | [`podman system events`](./docs/source/markdown/podman-events.1.md) | | `docker system info` | [`podman system info`](./docs/source/markdown/podman-system-info.1.md) | | `docker system prune` | [`podman system prune`](./docs/source/markdown/podman-system-prune.1.md)| | `docker tag` | [`podman tag`](./docs/source/markdown/podman-tag.1.md) |