diff options
author | Jhon Honce <jhonce@redhat.com> | 2020-05-20 14:24:18 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2020-05-22 07:51:29 -0700 |
commit | f51e0d0597757da72fd7a10085998052684e396b (patch) | |
tree | 0f7b197097bbb9ec682c23a318e86d36b687018a /cmd/podman | |
parent | 6aa802d8012a78ac95e4fe2017a5b54ec8d4b8de (diff) | |
download | podman-f51e0d0597757da72fd7a10085998052684e396b.tar.gz podman-f51e0d0597757da72fd7a10085998052684e396b.tar.bz2 podman-f51e0d0597757da72fd7a10085998052684e396b.zip |
V2 enable remote logs and testing
* wire up bindings and handler for obtaining logs remotely
* enable debug logging from podman in e2e test using DEBUG and
DEBUG_SERVICE env variables
* Fix error in streaming log frames
* enable remote logs test
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/containers/logs.go | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/cmd/podman/containers/logs.go b/cmd/podman/containers/logs.go index 2b8c3ed5f..de5234044 100644 --- a/cmd/podman/containers/logs.go +++ b/cmd/podman/containers/logs.go @@ -29,7 +29,18 @@ var ( Use: "logs [flags] CONTAINER [CONTAINER...]", Short: "Fetch the logs of one or more containers", Long: logsDescription, - RunE: logs, + Args: func(cmd *cobra.Command, args []string) error { + switch { + case registry.IsRemote() && len(args) > 1: + return errors.New(cmd.Name() + " does not support multiple containers when run remotely") + case logsOptions.Latest && len(args) > 0: + return errors.New("no containers can be specified when using 'latest'") + case !logsOptions.Latest && len(args) < 1: + return errors.New("specify at least one container name or ID to log") + } + return nil + }, + RunE: logs, Example: `podman logs ctrID podman logs --names ctrID1 ctrID2 podman logs --tail 2 mywebserver @@ -41,6 +52,7 @@ var ( Use: logsCommand.Use, Short: logsCommand.Short, Long: logsCommand.Long, + Args: logsCommand.Args, RunE: logsCommand.RunE, Example: `podman container logs ctrID podman container logs --names ctrID1 ctrID2 @@ -53,7 +65,7 @@ var ( func init() { // logs registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode}, + Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, Command: logsCommand, }) @@ -62,7 +74,7 @@ func init() { // container logs registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode}, + Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, Command: containerLogsCommand, Parent: containerCmd, }) @@ -84,12 +96,6 @@ func logsFlags(flags *pflag.FlagSet) { } func logs(cmd *cobra.Command, args []string) error { - if len(args) > 0 && logsOptions.Latest { - return errors.New("no containers can be specified when using 'latest'") - } - if !logsOptions.Latest && len(args) < 1 { - return errors.New("specify at least one container name or ID to log") - } if logsOptions.SinceRaw != "" { // parse time, error out if something is wrong since, err := util.ParseInputTime(logsOptions.SinceRaw) |