diff options
author | baude <bbaude@redhat.com> | 2019-04-15 09:53:38 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-04-15 12:21:51 -0500 |
commit | 6fb0a706af438778dd372d4b05b417fb30a45965 (patch) | |
tree | d1ba6e427d8524630ceb1c82eaec92c91b061e6f /cmd/podman | |
parent | 6e1dab76e2282774d384ec3bc46e314e9b030595 (diff) | |
download | podman-6fb0a706af438778dd372d4b05b417fb30a45965.tar.gz podman-6fb0a706af438778dd372d4b05b417fb30a45965.tar.bz2 podman-6fb0a706af438778dd372d4b05b417fb30a45965.zip |
Fix segfaults attribute to missing options
In cases where the remote client culls options to a command, we need to
be sure that the lookup for that flag does not result in a nil pointer.
To do so, we add a Remote attribute to the podman struct and then cli
helper funcs are now aware they are remote.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman')
77 files changed, 106 insertions, 10 deletions
diff --git a/cmd/podman/attach.go b/cmd/podman/attach.go index 2fa05a3b1..c07c0f1cf 100644 --- a/cmd/podman/attach.go +++ b/cmd/podman/attach.go @@ -17,6 +17,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { attachCommand.InputArgs = args attachCommand.GlobalFlags = MainGlobalOpts + attachCommand.Remote = remoteclient return attachCmd(&attachCommand) }, Example: `podman attach ctrID diff --git a/cmd/podman/build.go b/cmd/podman/build.go index f0a67791a..b69ac6e84 100644 --- a/cmd/podman/build.go +++ b/cmd/podman/build.go @@ -39,6 +39,7 @@ var ( buildCommand.FromAndBudResults = &fromAndBudValues buildCommand.LayerResults = &layerValues buildCommand.NameSpaceResults = &namespaceValues + buildCommand.Remote = remoteclient return buildCmd(&buildCommand) }, Example: `podman build . diff --git a/cmd/podman/checkpoint.go b/cmd/podman/checkpoint.go index 5b8d00ff9..f2f5d37da 100644 --- a/cmd/podman/checkpoint.go +++ b/cmd/podman/checkpoint.go @@ -23,6 +23,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { checkpointCommand.InputArgs = args checkpointCommand.GlobalFlags = MainGlobalOpts + checkpointCommand.Remote = remoteclient return checkpointCmd(&checkpointCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/cleanup.go b/cmd/podman/cleanup.go index 17e637da1..f5b3cf55b 100644 --- a/cmd/podman/cleanup.go +++ b/cmd/podman/cleanup.go @@ -24,6 +24,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { cleanupCommand.InputArgs = args cleanupCommand.GlobalFlags = MainGlobalOpts + cleanupCommand.Remote = remoteclient return cleanupCmd(&cleanupCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/cliconfig/commands.go b/cmd/podman/cliconfig/commands.go index 00b66e32a..f6d92611f 100644 --- a/cmd/podman/cliconfig/commands.go +++ b/cmd/podman/cliconfig/commands.go @@ -26,7 +26,9 @@ func (p *PodmanCommand) IsSet(opt string) bool { func (p *PodmanCommand) Bool(opt string) bool { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return false } val, err := p.Flags().GetBool(opt) @@ -40,7 +42,9 @@ func (p *PodmanCommand) Bool(opt string) bool { func (p *PodmanCommand) String(opt string) string { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return "" } val, err := p.Flags().GetString(opt) @@ -54,7 +58,9 @@ func (p *PodmanCommand) String(opt string) string { func (p *PodmanCommand) StringArray(opt string) []string { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return []string{} } val, err := p.Flags().GetStringArray(opt) @@ -68,7 +74,9 @@ func (p *PodmanCommand) StringArray(opt string) []string { func (p *PodmanCommand) StringSlice(opt string) []string { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return []string{} } val, err := p.Flags().GetStringSlice(opt) @@ -82,7 +90,9 @@ func (p *PodmanCommand) StringSlice(opt string) []string { func (p *PodmanCommand) Int(opt string) int { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return 0 } val, err := p.Flags().GetInt(opt) @@ -96,7 +106,9 @@ func (p *PodmanCommand) Int(opt string) int { func (p *PodmanCommand) Uint(opt string) uint { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return 0 } val, err := p.Flags().GetUint(opt) @@ -110,7 +122,9 @@ func (p *PodmanCommand) Uint(opt string) uint { func (p *PodmanCommand) Int64(opt string) int64 { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return 0 } val, err := p.Flags().GetInt64(opt) @@ -124,7 +138,9 @@ func (p *PodmanCommand) Int64(opt string) int64 { func (p *PodmanCommand) Uint64(opt string) uint64 { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return 0 } val, err := p.Flags().GetUint64(opt) @@ -138,7 +154,9 @@ func (p *PodmanCommand) Uint64(opt string) uint64 { func (p *PodmanCommand) Float64(opt string) float64 { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return 0 } val, err := p.Flags().GetFloat64(opt) diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go index 2692ace36..982c77c17 100644 --- a/cmd/podman/cliconfig/config.go +++ b/cmd/podman/cliconfig/config.go @@ -8,6 +8,7 @@ type PodmanCommand struct { *cobra.Command InputArgs []string GlobalFlags MainFlags + Remote bool } type MainFlags struct { diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go index 0077ff297..5963f8686 100644 --- a/cmd/podman/commit.go +++ b/cmd/podman/commit.go @@ -28,6 +28,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { commitCommand.InputArgs = args commitCommand.GlobalFlags = MainGlobalOpts + commitCommand.Remote = remoteclient return commitCmd(&commitCommand) }, Example: `podman commit -q --message "committing container to image" reverent_golick image-commited diff --git a/cmd/podman/containers_prune.go b/cmd/podman/containers_prune.go index 39be70c5b..abc56cee1 100644 --- a/cmd/podman/containers_prune.go +++ b/cmd/podman/containers_prune.go @@ -27,6 +27,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { pruneContainersCommand.InputArgs = args pruneContainersCommand.GlobalFlags = MainGlobalOpts + pruneContainersCommand.Remote = remoteclient return pruneContainersCmd(&pruneContainersCommand) }, } diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go index 7dee37287..6e48b9f3b 100644 --- a/cmd/podman/cp.go +++ b/cmd/podman/cp.go @@ -36,6 +36,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { cpCommand.InputArgs = args cpCommand.GlobalFlags = MainGlobalOpts + cpCommand.Remote = remoteclient return cpCmd(&cpCommand) }, Example: "[CONTAINER:]SRC_PATH [CONTAINER:]DEST_PATH", diff --git a/cmd/podman/create.go b/cmd/podman/create.go index 3267e5b7b..cfc0fa0c3 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { createCommand.InputArgs = args createCommand.GlobalFlags = MainGlobalOpts + createCommand.Remote = remoteclient return createCmd(&createCommand) }, Example: `podman create alpine ls diff --git a/cmd/podman/diff.go b/cmd/podman/diff.go index 7f5a313f8..1138c48a3 100644 --- a/cmd/podman/diff.go +++ b/cmd/podman/diff.go @@ -43,6 +43,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { diffCommand.InputArgs = args diffCommand.GlobalFlags = MainGlobalOpts + diffCommand.Remote = remoteclient return diffCmd(&diffCommand) }, Example: `podman diff imageID diff --git a/cmd/podman/events.go b/cmd/podman/events.go index f6c20e8ff..4c11fe1f3 100644 --- a/cmd/podman/events.go +++ b/cmd/podman/events.go @@ -18,6 +18,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { eventsCommand.InputArgs = args eventsCommand.GlobalFlags = MainGlobalOpts + eventsCommand.Remote = remoteclient return eventsCmd(&eventsCommand) }, Example: `podman events diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go index f720a9aff..d0d88ee8b 100644 --- a/cmd/podman/exec.go +++ b/cmd/podman/exec.go @@ -26,6 +26,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { execCommand.InputArgs = args execCommand.GlobalFlags = MainGlobalOpts + execCommand.Remote = remoteclient return execCmd(&execCommand) }, Example: `podman exec -it ctrID ls diff --git a/cmd/podman/exists.go b/cmd/podman/exists.go index 8a2f78c88..dae48f14b 100644 --- a/cmd/podman/exists.go +++ b/cmd/podman/exists.go @@ -29,6 +29,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { imageExistsCommand.InputArgs = args imageExistsCommand.GlobalFlags = MainGlobalOpts + imageExistsCommand.Remote = remoteclient return imageExistsCmd(&imageExistsCommand) }, Example: `podman image exists imageID @@ -42,6 +43,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { containerExistsCommand.InputArgs = args containerExistsCommand.GlobalFlags = MainGlobalOpts + containerExistsCommand.Remote = remoteclient return containerExistsCmd(&containerExistsCommand) }, @@ -56,6 +58,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podExistsCommand.InputArgs = args podExistsCommand.GlobalFlags = MainGlobalOpts + podExistsCommand.Remote = remoteclient return podExistsCmd(&podExistsCommand) }, Example: `podman pod exists podID diff --git a/cmd/podman/export.go b/cmd/podman/export.go index db031aaf2..004c3ccde 100644 --- a/cmd/podman/export.go +++ b/cmd/podman/export.go @@ -23,6 +23,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { exportCommand.InputArgs = args exportCommand.GlobalFlags = MainGlobalOpts + exportCommand.Remote = remoteclient return exportCmd(&exportCommand) }, Example: `podman export ctrID > myCtr.tar diff --git a/cmd/podman/generate_kube.go b/cmd/podman/generate_kube.go index 30818403b..7963cde6e 100644 --- a/cmd/podman/generate_kube.go +++ b/cmd/podman/generate_kube.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { containerKubeCommand.InputArgs = args containerKubeCommand.GlobalFlags = MainGlobalOpts + containerKubeCommand.Remote = remoteclient return generateKubeYAMLCmd(&containerKubeCommand) }, Example: `podman generate kube ctrID diff --git a/cmd/podman/healthcheck_run.go b/cmd/podman/healthcheck_run.go index bd3a4ea15..832451e0c 100644 --- a/cmd/podman/healthcheck_run.go +++ b/cmd/podman/healthcheck_run.go @@ -20,6 +20,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { healthcheckRunCommand.InputArgs = args healthcheckRunCommand.GlobalFlags = MainGlobalOpts + healthcheckRunCommand.Remote = remoteclient return healthCheckCmd(&healthcheckRunCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/history.go b/cmd/podman/history.go index 4b76ef0ca..f96d7934c 100644 --- a/cmd/podman/history.go +++ b/cmd/podman/history.go @@ -47,6 +47,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { historyCommand.InputArgs = args historyCommand.GlobalFlags = MainGlobalOpts + historyCommand.Remote = remoteclient return historyCmd(&historyCommand) }, } diff --git a/cmd/podman/images.go b/cmd/podman/images.go index c38d7035d..f584c1131 100644 --- a/cmd/podman/images.go +++ b/cmd/podman/images.go @@ -96,6 +96,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { imagesCommand.InputArgs = args imagesCommand.GlobalFlags = MainGlobalOpts + imagesCommand.Remote = remoteclient return imagesCmd(&imagesCommand) }, Example: `podman images --format json diff --git a/cmd/podman/images_prune.go b/cmd/podman/images_prune.go index b6f335fb3..84181d0a2 100644 --- a/cmd/podman/images_prune.go +++ b/cmd/podman/images_prune.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { pruneImagesCommand.InputArgs = args pruneImagesCommand.GlobalFlags = MainGlobalOpts + pruneImagesCommand.Remote = remoteclient return pruneImagesCmd(&pruneImagesCommand) }, } diff --git a/cmd/podman/import.go b/cmd/podman/import.go index f3fb7c988..2bba6cb0c 100644 --- a/cmd/podman/import.go +++ b/cmd/podman/import.go @@ -24,6 +24,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { importCommand.InputArgs = args importCommand.GlobalFlags = MainGlobalOpts + importCommand.Remote = remoteclient return importCmd(&importCommand) }, Example: `podman import http://example.com/ctr.tar url-image diff --git a/cmd/podman/info.go b/cmd/podman/info.go index 195267c7f..2b6ae1882 100644 --- a/cmd/podman/info.go +++ b/cmd/podman/info.go @@ -28,6 +28,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { infoCommand.InputArgs = args infoCommand.GlobalFlags = MainGlobalOpts + infoCommand.Remote = remoteclient return infoCmd(&infoCommand) }, Example: `podman info`, diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go index 528320170..9491bc7c7 100644 --- a/cmd/podman/inspect.go +++ b/cmd/podman/inspect.go @@ -33,6 +33,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { inspectCommand.InputArgs = args inspectCommand.GlobalFlags = MainGlobalOpts + inspectCommand.Remote = remoteclient return inspectCmd(&inspectCommand) }, Example: `podman inspect alpine diff --git a/cmd/podman/kill.go b/cmd/podman/kill.go index 20142e0bf..0513a154f 100644 --- a/cmd/podman/kill.go +++ b/cmd/podman/kill.go @@ -20,6 +20,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { killCommand.InputArgs = args killCommand.GlobalFlags = MainGlobalOpts + killCommand.Remote = remoteclient return killCmd(&killCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/load.go b/cmd/podman/load.go index 04ff9fcca..3cc5e67c7 100644 --- a/cmd/podman/load.go +++ b/cmd/podman/load.go @@ -27,6 +27,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { loadCommand.InputArgs = args loadCommand.GlobalFlags = MainGlobalOpts + loadCommand.Remote = remoteclient return loadCmd(&loadCommand) }, } diff --git a/cmd/podman/login.go b/cmd/podman/login.go index 8a1687278..589255683 100644 --- a/cmd/podman/login.go +++ b/cmd/podman/login.go @@ -27,6 +27,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { loginCommand.InputArgs = args loginCommand.GlobalFlags = MainGlobalOpts + loginCommand.Remote = remoteclient return loginCmd(&loginCommand) }, Example: `podman login -u testuser -p testpassword localhost:5000 diff --git a/cmd/podman/logout.go b/cmd/podman/logout.go index 069153e0b..8abe918b8 100644 --- a/cmd/podman/logout.go +++ b/cmd/podman/logout.go @@ -20,6 +20,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { logoutCommand.InputArgs = args logoutCommand.GlobalFlags = MainGlobalOpts + logoutCommand.Remote = remoteclient return logoutCmd(&logoutCommand) }, Example: `podman logout docker.io diff --git a/cmd/podman/logs.go b/cmd/podman/logs.go index a1b5fb4cc..6f24dc8fb 100644 --- a/cmd/podman/logs.go +++ b/cmd/podman/logs.go @@ -24,6 +24,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { logsCommand.InputArgs = args logsCommand.GlobalFlags = MainGlobalOpts + logsCommand.Remote = remoteclient return logsCmd(&logsCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/main_local.go b/cmd/podman/main_local.go index e008a4617..f234368bf 100644 --- a/cmd/podman/main_local.go +++ b/cmd/podman/main_local.go @@ -110,6 +110,7 @@ func setupRootless(cmd *cobra.Command, args []string) error { cmd, args, MainGlobalOpts, + remoteclient, } runtime, err := libpodruntime.GetRuntime(&podmanCmd) if err != nil { diff --git a/cmd/podman/mount.go b/cmd/podman/mount.go index a70684a39..2ade8949a 100644 --- a/cmd/podman/mount.go +++ b/cmd/podman/mount.go @@ -31,6 +31,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { mountCommand.InputArgs = args mountCommand.GlobalFlags = MainGlobalOpts + mountCommand.Remote = remoteclient return mountCmd(&mountCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go index fa4648128..3e6d36571 100644 --- a/cmd/podman/pause.go +++ b/cmd/podman/pause.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { pauseCommand.InputArgs = args pauseCommand.GlobalFlags = MainGlobalOpts + pauseCommand.Remote = remoteclient return pauseCmd(&pauseCommand) }, Example: `podman pause mywebserver diff --git a/cmd/podman/play_kube.go b/cmd/podman/play_kube.go index 942794cbe..039d4bff6 100644 --- a/cmd/podman/play_kube.go +++ b/cmd/podman/play_kube.go @@ -42,6 +42,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { playKubeCommand.InputArgs = args playKubeCommand.GlobalFlags = MainGlobalOpts + playKubeCommand.Remote = remoteclient return playKubeYAMLCmd(&playKubeCommand) }, Example: `podman play kube demo.yml diff --git a/cmd/podman/pod_create.go b/cmd/podman/pod_create.go index 2f7a6b415..551010dce 100644 --- a/cmd/podman/pod_create.go +++ b/cmd/podman/pod_create.go @@ -30,6 +30,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podCreateCommand.InputArgs = args podCreateCommand.GlobalFlags = MainGlobalOpts + podCreateCommand.Remote = remoteclient return podCreateCmd(&podCreateCommand) }, } diff --git a/cmd/podman/pod_inspect.go b/cmd/podman/pod_inspect.go index e12678354..eb2366031 100644 --- a/cmd/podman/pod_inspect.go +++ b/cmd/podman/pod_inspect.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podInspectCommand.InputArgs = args podInspectCommand.GlobalFlags = MainGlobalOpts + podInspectCommand.Remote = remoteclient return podInspectCmd(&podInspectCommand) }, Example: `podman pod inspect podID`, diff --git a/cmd/podman/pod_kill.go b/cmd/podman/pod_kill.go index ebd7db762..145d0492f 100644 --- a/cmd/podman/pod_kill.go +++ b/cmd/podman/pod_kill.go @@ -24,6 +24,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podKillCommand.InputArgs = args podKillCommand.GlobalFlags = MainGlobalOpts + podKillCommand.Remote = remoteclient return podKillCmd(&podKillCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/pod_pause.go b/cmd/podman/pod_pause.go index ff29e0e1d..1c6611ebc 100644 --- a/cmd/podman/pod_pause.go +++ b/cmd/podman/pod_pause.go @@ -21,6 +21,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podPauseCommand.InputArgs = args podPauseCommand.GlobalFlags = MainGlobalOpts + podPauseCommand.Remote = remoteclient return podPauseCmd(&podPauseCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/pod_ps.go b/cmd/podman/pod_ps.go index a956882cf..f4b7437eb 100644 --- a/cmd/podman/pod_ps.go +++ b/cmd/podman/pod_ps.go @@ -127,6 +127,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podPsCommand.InputArgs = args podPsCommand.GlobalFlags = MainGlobalOpts + podPsCommand.Remote = remoteclient return podPsCmd(&podPsCommand) }, } diff --git a/cmd/podman/pod_restart.go b/cmd/podman/pod_restart.go index 0765b98db..519568974 100644 --- a/cmd/podman/pod_restart.go +++ b/cmd/podman/pod_restart.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podRestartCommand.InputArgs = args podRestartCommand.GlobalFlags = MainGlobalOpts + podRestartCommand.Remote = remoteclient return podRestartCmd(&podRestartCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/pod_rm.go b/cmd/podman/pod_rm.go index cd9f23fe1..dd67bb0e0 100644 --- a/cmd/podman/pod_rm.go +++ b/cmd/podman/pod_rm.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podRmCommand.InputArgs = args podRmCommand.GlobalFlags = MainGlobalOpts + podRmCommand.Remote = remoteclient return podRmCmd(&podRmCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/pod_start.go b/cmd/podman/pod_start.go index 949af80d8..104f9ad73 100644 --- a/cmd/podman/pod_start.go +++ b/cmd/podman/pod_start.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podStartCommand.InputArgs = args podStartCommand.GlobalFlags = MainGlobalOpts + podStartCommand.Remote = remoteclient return podStartCmd(&podStartCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/pod_stats.go b/cmd/podman/pod_stats.go index 36b0b95ed..ed59d9a61 100644 --- a/cmd/podman/pod_stats.go +++ b/cmd/podman/pod_stats.go @@ -29,6 +29,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podStatsCommand.InputArgs = args podStatsCommand.GlobalFlags = MainGlobalOpts + podStatsCommand.Remote = remoteclient return podStatsCmd(&podStatsCommand) }, Example: `podman stats -a --no-stream diff --git a/cmd/podman/pod_stop.go b/cmd/podman/pod_stop.go index f1b0ac51f..9cd425c29 100644 --- a/cmd/podman/pod_stop.go +++ b/cmd/podman/pod_stop.go @@ -23,6 +23,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podStopCommand.InputArgs = args podStopCommand.GlobalFlags = MainGlobalOpts + podStopCommand.Remote = remoteclient return podStopCmd(&podStopCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/pod_top.go b/cmd/podman/pod_top.go index 0d74dc3d6..e997d1456 100644 --- a/cmd/podman/pod_top.go +++ b/cmd/podman/pod_top.go @@ -28,6 +28,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podTopCommand.InputArgs = args podTopCommand.GlobalFlags = MainGlobalOpts + podTopCommand.Remote = remoteclient return podTopCmd(&podTopCommand) }, Example: `podman top ctrID diff --git a/cmd/podman/pod_unpause.go b/cmd/podman/pod_unpause.go index 0623c6abb..15375bee9 100644 --- a/cmd/podman/pod_unpause.go +++ b/cmd/podman/pod_unpause.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { podUnpauseCommand.InputArgs = args podUnpauseCommand.GlobalFlags = MainGlobalOpts + podUnpauseCommand.Remote = remoteclient return podUnpauseCmd(&podUnpauseCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/port.go b/cmd/podman/port.go index b5a4d3eec..d63ae4aa9 100644 --- a/cmd/podman/port.go +++ b/cmd/podman/port.go @@ -23,6 +23,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { portCommand.InputArgs = args portCommand.GlobalFlags = MainGlobalOpts + portCommand.Remote = remoteclient return portCmd(&portCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index 5bb88f227..a9e46d6b9 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -161,6 +161,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { psCommand.InputArgs = args psCommand.GlobalFlags = MainGlobalOpts + psCommand.Remote = remoteclient return psCmd(&psCommand) }, Example: `podman ps -a diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index 7cc7b65b3..04eb5bd46 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -32,6 +32,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { pullCommand.InputArgs = args pullCommand.GlobalFlags = MainGlobalOpts + pullCommand.Remote = remoteclient return pullCmd(&pullCommand) }, Example: `podman pull imageName @@ -117,7 +118,7 @@ func pullCmd(c *cliconfig.PullValues) (retError error) { DockerRegistryCreds: registryCreds, DockerCertPath: c.CertDir, } - if c.Flag("tls-verify").Changed { + if c.IsSet("tls-verify") { dockerRegistryOptions.DockerInsecureSkipTLSVerify = types.NewOptionalBool(!c.TlsVerify) } diff --git a/cmd/podman/push.go b/cmd/podman/push.go index a5638a698..e6beaaeb4 100644 --- a/cmd/podman/push.go +++ b/cmd/podman/push.go @@ -31,6 +31,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { pushCommand.InputArgs = args pushCommand.GlobalFlags = MainGlobalOpts + pushCommand.Remote = remoteclient return pushCmd(&pushCommand) }, Example: `podman push imageID docker://registry.example.com/repository:tag diff --git a/cmd/podman/refresh.go b/cmd/podman/refresh.go index ed2e173ab..6640d9954 100644 --- a/cmd/podman/refresh.go +++ b/cmd/podman/refresh.go @@ -24,6 +24,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { refreshCommand.InputArgs = args refreshCommand.GlobalFlags = MainGlobalOpts + refreshCommand.Remote = remoteclient return refreshCmd(&refreshCommand) }, } diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go index 1553ab805..5a9f3043a 100644 --- a/cmd/podman/restart.go +++ b/cmd/podman/restart.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { restartCommand.InputArgs = args restartCommand.GlobalFlags = MainGlobalOpts + restartCommand.Remote = remoteclient return restartCmd(&restartCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/restore.go b/cmd/podman/restore.go index 0f0150644..d9e85c267 100644 --- a/cmd/podman/restore.go +++ b/cmd/podman/restore.go @@ -23,6 +23,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { restoreCommand.InputArgs = args restoreCommand.GlobalFlags = MainGlobalOpts + restoreCommand.Remote = remoteclient return restoreCmd(&restoreCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go index 66f70a36f..e3ee186ce 100644 --- a/cmd/podman/rm.go +++ b/cmd/podman/rm.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { rmCommand.InputArgs = args rmCommand.GlobalFlags = MainGlobalOpts + rmCommand.Remote = remoteclient return rmCmd(&rmCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/rmi.go b/cmd/podman/rmi.go index 149cd8d82..7ec875d5b 100644 --- a/cmd/podman/rmi.go +++ b/cmd/podman/rmi.go @@ -21,6 +21,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { rmiCommand.InputArgs = args rmiCommand.GlobalFlags = MainGlobalOpts + rmiCommand.Remote = remoteclient return rmiCmd(&rmiCommand) }, Example: `podman rmi imageID diff --git a/cmd/podman/run.go b/cmd/podman/run.go index d3158de6b..717a36e04 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -19,6 +19,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { runCommand.InputArgs = args runCommand.GlobalFlags = MainGlobalOpts + runCommand.Remote = remoteclient return runCmd(&runCommand) }, Example: `podman run imageID ls -alF /etc diff --git a/cmd/podman/runlabel.go b/cmd/podman/runlabel.go index f79aa8b0e..8267e941f 100644 --- a/cmd/podman/runlabel.go +++ b/cmd/podman/runlabel.go @@ -30,6 +30,7 @@ Executes a command as described by a container image label. RunE: func(cmd *cobra.Command, args []string) error { runlabelCommand.InputArgs = args runlabelCommand.GlobalFlags = MainGlobalOpts + runlabelCommand.Remote = remoteclient return runlabelCmd(&runlabelCommand) }, Example: `podman container runlabel run imageID diff --git a/cmd/podman/save.go b/cmd/podman/save.go index c10679740..a45223b6a 100644 --- a/cmd/podman/save.go +++ b/cmd/podman/save.go @@ -33,6 +33,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { saveCommand.InputArgs = args saveCommand.GlobalFlags = MainGlobalOpts + saveCommand.Remote = remoteclient return saveCmd(&saveCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/search.go b/cmd/podman/search.go index e614887fc..13948aef0 100644 --- a/cmd/podman/search.go +++ b/cmd/podman/search.go @@ -29,6 +29,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { searchCommand.InputArgs = args searchCommand.GlobalFlags = MainGlobalOpts + searchCommand.Remote = remoteclient return searchCmd(&searchCommand) }, Example: `podman search --filter=is-official --limit 3 alpine diff --git a/cmd/podman/sign.go b/cmd/podman/sign.go index 75d723514..b19b6a840 100644 --- a/cmd/podman/sign.go +++ b/cmd/podman/sign.go @@ -30,6 +30,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { signCommand.InputArgs = args signCommand.GlobalFlags = MainGlobalOpts + signCommand.Remote = remoteclient return signCmd(&signCommand) }, Example: `podman sign --sign-by mykey imageID diff --git a/cmd/podman/start.go b/cmd/podman/start.go index 7d97319dd..ec05ce90e 100644 --- a/cmd/podman/start.go +++ b/cmd/podman/start.go @@ -25,6 +25,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { startCommand.InputArgs = args startCommand.GlobalFlags = MainGlobalOpts + startCommand.Remote = remoteclient return startCmd(&startCommand) }, Example: `podman start --latest diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go index d379dbad7..6aa0cc10c 100644 --- a/cmd/podman/stats.go +++ b/cmd/podman/stats.go @@ -39,6 +39,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { statsCommand.InputArgs = args statsCommand.GlobalFlags = MainGlobalOpts + statsCommand.Remote = remoteclient return statsCmd(&statsCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go index 38d90fe81..f263bb166 100644 --- a/cmd/podman/stop.go +++ b/cmd/podman/stop.go @@ -21,6 +21,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { stopCommand.InputArgs = args stopCommand.GlobalFlags = MainGlobalOpts + stopCommand.Remote = remoteclient return stopCmd(&stopCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/system_df.go b/cmd/podman/system_df.go index 992e869bd..16a8ad120 100644 --- a/cmd/podman/system_df.go +++ b/cmd/podman/system_df.go @@ -33,6 +33,7 @@ var ( Long: dfSystemDescription, RunE: func(cmd *cobra.Command, args []string) error { dfSystemCommand.GlobalFlags = MainGlobalOpts + dfSystemCommand.Remote = remoteclient return dfSystemCmd(&dfSystemCommand) }, } diff --git a/cmd/podman/system_prune.go b/cmd/podman/system_prune.go index 624f24acb..436d54823 100644 --- a/cmd/podman/system_prune.go +++ b/cmd/podman/system_prune.go @@ -29,6 +29,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { pruneSystemCommand.InputArgs = args pruneSystemCommand.GlobalFlags = MainGlobalOpts + pruneSystemCommand.Remote = remoteclient return pruneSystemCmd(&pruneSystemCommand) }, } diff --git a/cmd/podman/system_renumber.go b/cmd/podman/system_renumber.go index ed0b28a3c..70ba706bb 100644 --- a/cmd/podman/system_renumber.go +++ b/cmd/podman/system_renumber.go @@ -24,6 +24,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { renumberCommand.InputArgs = args renumberCommand.GlobalFlags = MainGlobalOpts + renumberCommand.Remote = remoteclient return renumberCmd(&renumberCommand) }, } diff --git a/cmd/podman/tag.go b/cmd/podman/tag.go index 98d9a6856..deda4e985 100644 --- a/cmd/podman/tag.go +++ b/cmd/podman/tag.go @@ -18,6 +18,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { tagCommand.InputArgs = args tagCommand.GlobalFlags = MainGlobalOpts + tagCommand.Remote = remoteclient return tagCmd(&tagCommand) }, Example: `podman tag 0e3bbc2 fedora:latest diff --git a/cmd/podman/top.go b/cmd/podman/top.go index 5d394d2d6..0b7da64a8 100644 --- a/cmd/podman/top.go +++ b/cmd/podman/top.go @@ -39,6 +39,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { topCommand.InputArgs = args topCommand.GlobalFlags = MainGlobalOpts + topCommand.Remote = remoteclient return topCmd(&topCommand) }, Example: `podman top ctrID diff --git a/cmd/podman/tree.go b/cmd/podman/tree.go index 371e88495..f205c83e4 100644 --- a/cmd/podman/tree.go +++ b/cmd/podman/tree.go @@ -29,6 +29,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { treeCommand.InputArgs = args treeCommand.GlobalFlags = MainGlobalOpts + treeCommand.Remote = remoteclient return treeCmd(&treeCommand) }, Example: "podman image tree alpine:latest", diff --git a/cmd/podman/trust_set_show.go b/cmd/podman/trust_set_show.go index 626d27aae..580331673 100644 --- a/cmd/podman/trust_set_show.go +++ b/cmd/podman/trust_set_show.go @@ -29,6 +29,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { setTrustCommand.InputArgs = args setTrustCommand.GlobalFlags = MainGlobalOpts + setTrustCommand.Remote = remoteclient return setTrustCmd(&setTrustCommand) }, } diff --git a/cmd/podman/umount.go b/cmd/podman/umount.go index 914e37cfa..cdf8b951a 100644 --- a/cmd/podman/umount.go +++ b/cmd/podman/umount.go @@ -24,6 +24,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { umountCommand.InputArgs = args umountCommand.GlobalFlags = MainGlobalOpts + umountCommand.Remote = remoteclient return umountCmd(&umountCommand) }, Args: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go index 0c52a2443..65e841b36 100644 --- a/cmd/podman/unpause.go +++ b/cmd/podman/unpause.go @@ -23,6 +23,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { unpauseCommand.InputArgs = args unpauseCommand.GlobalFlags = MainGlobalOpts + unpauseCommand.Remote = remoteclient return unpauseCmd(&unpauseCommand) }, Example: `podman unpause ctrID diff --git a/cmd/podman/version.go b/cmd/podman/version.go index 31b0b8e82..e964bdbb5 100644 --- a/cmd/podman/version.go +++ b/cmd/podman/version.go @@ -23,6 +23,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { versionCommand.InputArgs = args versionCommand.GlobalFlags = MainGlobalOpts + versionCommand.Remote = remoteclient return versionCmd(&versionCommand) }, } diff --git a/cmd/podman/volume_create.go b/cmd/podman/volume_create.go index 8f6237272..2b10adb2b 100644 --- a/cmd/podman/volume_create.go +++ b/cmd/podman/volume_create.go @@ -21,6 +21,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { volumeCreateCommand.InputArgs = args volumeCreateCommand.GlobalFlags = MainGlobalOpts + volumeCreateCommand.Remote = remoteclient return volumeCreateCmd(&volumeCreateCommand) }, Example: `podman volume create myvol diff --git a/cmd/podman/volume_inspect.go b/cmd/podman/volume_inspect.go index fdd8b5b0b..66d394307 100644 --- a/cmd/podman/volume_inspect.go +++ b/cmd/podman/volume_inspect.go @@ -19,6 +19,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { volumeInspectCommand.InputArgs = args volumeInspectCommand.GlobalFlags = MainGlobalOpts + volumeInspectCommand.Remote = remoteclient return volumeInspectCmd(&volumeInspectCommand) }, Example: `podman volume inspect myvol diff --git a/cmd/podman/volume_ls.go b/cmd/podman/volume_ls.go index 2f35462a3..b9ab89196 100644 --- a/cmd/podman/volume_ls.go +++ b/cmd/podman/volume_ls.go @@ -54,6 +54,7 @@ and the output format can be changed to JSON or a user specified Go template.` RunE: func(cmd *cobra.Command, args []string) error { volumeLsCommand.InputArgs = args volumeLsCommand.GlobalFlags = MainGlobalOpts + volumeLsCommand.Remote = remoteclient return volumeLsCmd(&volumeLsCommand) }, } diff --git a/cmd/podman/volume_prune.go b/cmd/podman/volume_prune.go index 70ba506e7..ad62bfc22 100644 --- a/cmd/podman/volume_prune.go +++ b/cmd/podman/volume_prune.go @@ -28,6 +28,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { volumePruneCommand.InputArgs = args volumePruneCommand.GlobalFlags = MainGlobalOpts + volumePruneCommand.Remote = remoteclient return volumePruneCmd(&volumePruneCommand) }, } diff --git a/cmd/podman/volume_rm.go b/cmd/podman/volume_rm.go index 8c6d5e97a..4534019c6 100644 --- a/cmd/podman/volume_rm.go +++ b/cmd/podman/volume_rm.go @@ -22,6 +22,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { volumeRmCommand.InputArgs = args volumeRmCommand.GlobalFlags = MainGlobalOpts + volumeRmCommand.Remote = remoteclient return volumeRmCmd(&volumeRmCommand) }, Example: `podman volume rm myvol1 myvol2 diff --git a/cmd/podman/wait.go b/cmd/podman/wait.go index 827ac6826..97ec75b0c 100644 --- a/cmd/podman/wait.go +++ b/cmd/podman/wait.go @@ -21,6 +21,7 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { waitCommand.InputArgs = args waitCommand.GlobalFlags = MainGlobalOpts + waitCommand.Remote = remoteclient return waitCmd(&waitCommand) }, Example: `podman wait --latest |