mirror of
https://github.com/containers/podman.git
synced 2025-06-19 08:09:12 +08:00
Add podman system events alias to podman events
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -16,13 +16,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
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.`
|
By default, streaming mode is used, printing new events as they occur. Previous events can be listed via --since and --until.`
|
||||||
eventsCommand = &cobra.Command{
|
eventsCommand = &cobra.Command{
|
||||||
Use: "events [options]",
|
Use: "events [options]",
|
||||||
Args: validate.NoArgs,
|
Args: validate.NoArgs,
|
||||||
Short: "Show podman events",
|
Short: "Show podman system events",
|
||||||
Long: eventsDescription,
|
Long: eventsDescription,
|
||||||
RunE: eventsCmd,
|
RunE: eventsCmd,
|
||||||
ValidArgsFunction: completion.AutocompleteNone,
|
ValidArgsFunction: completion.AutocompleteNone,
|
||||||
@ -31,6 +31,16 @@ var (
|
|||||||
podman events --format {{.Image}}
|
podman events --format {{.Image}}
|
||||||
podman events --since 1h30s`,
|
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 (
|
var (
|
||||||
@ -40,30 +50,39 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||||
|
Command: systemEventsCommand,
|
||||||
|
Parent: systemCmd,
|
||||||
|
})
|
||||||
|
eventsFlags(systemEventsCommand)
|
||||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||||
Command: eventsCommand,
|
Command: eventsCommand,
|
||||||
})
|
})
|
||||||
flags := eventsCommand.Flags()
|
eventsFlags(eventsCommand)
|
||||||
|
}
|
||||||
|
|
||||||
|
func eventsFlags(cmd *cobra.Command) {
|
||||||
|
flags := cmd.Flags()
|
||||||
|
|
||||||
filterFlagName := "filter"
|
filterFlagName := "filter"
|
||||||
flags.StringArrayVarP(&eventOptions.Filter, filterFlagName, "f", []string{}, "filter output")
|
flags.StringArrayVarP(&eventOptions.Filter, filterFlagName, "f", []string{}, "filter output")
|
||||||
_ = eventsCommand.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteEventFilter)
|
_ = cmd.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteEventFilter)
|
||||||
|
|
||||||
formatFlagName := "format"
|
formatFlagName := "format"
|
||||||
flags.StringVar(&eventFormat, formatFlagName, "", "format the output using a Go template")
|
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")
|
flags.BoolVar(&eventOptions.Stream, "stream", true, "stream new events; for testing only")
|
||||||
|
|
||||||
sinceFlagName := "since"
|
sinceFlagName := "since"
|
||||||
flags.StringVar(&eventOptions.Since, sinceFlagName, "", "show all events created since timestamp")
|
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")
|
flags.BoolVar(&noTrunc, "no-trunc", true, "do not truncate the output")
|
||||||
|
|
||||||
untilFlagName := "until"
|
untilFlagName := "until"
|
||||||
flags.StringVar(&eventOptions.Until, untilFlagName, "", "show all events until timestamp")
|
flags.StringVar(&eventOptions.Until, untilFlagName, "", "show all events until timestamp")
|
||||||
_ = eventsCommand.RegisterFlagCompletionFunc(untilFlagName, completion.AutocompleteNone)
|
_ = cmd.RegisterFlagCompletionFunc(untilFlagName, completion.AutocompleteNone)
|
||||||
|
|
||||||
_ = flags.MarkHidden("stream")
|
_ = flags.MarkHidden("stream")
|
||||||
}
|
}
|
||||||
|
@ -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-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(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-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-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-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 |
|
| [podman-system-prune(1)](https://podman.readthedocs.io/en/latest/markdown/podman-system-prune.1.html) | Remove all unused container, image and volume data |
|
||||||
|
1
docs/source/markdown/links/podman-system-events.1
Normal file
1
docs/source/markdown/links/podman-system-events.1
Normal file
@ -0,0 +1 @@
|
|||||||
|
.so man1/podman-events.1
|
@ -6,6 +6,8 @@ podman\-events - Monitor Podman events
|
|||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
**podman events** [*options*]
|
**podman events** [*options*]
|
||||||
|
|
||||||
|
**podman system events** [*options*]
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
||||||
Monitor and print events that occur in Podman. Each event will include a timestamp,
|
Monitor and print events that occur in Podman. Each event will include a timestamp,
|
||||||
|
@ -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) |
|
| 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. |
|
| 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. |
|
| 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. |
|
| 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. |
|
| prune | [podman-system-prune(1)](podman-system-prune.1.md) | Remove all unused pods, containers, images, networks, and volume data. |
|
||||||
|
@ -17,7 +17,7 @@ load helpers
|
|||||||
is "$output" "$expect" "filtering by container name and label"
|
is "$output" "$expect" "filtering by container name and label"
|
||||||
|
|
||||||
# Same thing, but without the container-name filter
|
# 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"
|
is "$output" "$expect" "filtering just by label"
|
||||||
|
|
||||||
# Now filter just by container name, no label
|
# Now filter just by container name, no label
|
||||||
|
@ -37,6 +37,7 @@ search | $IMAGE
|
|||||||
pod inspect | mypod
|
pod inspect | mypod
|
||||||
|
|
||||||
events | --stream=false --events-backend=file
|
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.
|
# podman machine is finicky. Assume we can't run it, but see below for more.
|
||||||
|
@ -87,6 +87,7 @@ There are other equivalents for these tools
|
|||||||
| `docker stop` | [`podman stop`](./docs/source/markdown/podman-stop.1.md) |
|
| `docker stop` | [`podman stop`](./docs/source/markdown/podman-stop.1.md) |
|
||||||
| `docker system ` | [`podman system`](./docs/source/markdown/podman-system.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 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 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 system prune` | [`podman system prune`](./docs/source/markdown/podman-system-prune.1.md)|
|
||||||
| `docker tag` | [`podman tag`](./docs/source/markdown/podman-tag.1.md) |
|
| `docker tag` | [`podman tag`](./docs/source/markdown/podman-tag.1.md) |
|
||||||
|
Reference in New Issue
Block a user