diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-11-30 16:12:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-30 16:12:23 +0100 |
commit | 31bc3586be57f459bc30124ce6dbca98f98836e8 (patch) | |
tree | b125b7fad9f736445c34f6688f5d4dd28513b1bd /cmd | |
parent | 67d5b21f66beb58f9bfe25451e812a741d5c017d (diff) | |
parent | 47a8e7c9f9759f1775a0d59dd292eb375accd903 (diff) | |
download | podman-31bc3586be57f459bc30124ce6dbca98f98836e8.tar.gz podman-31bc3586be57f459bc30124ce6dbca98f98836e8.tar.bz2 podman-31bc3586be57f459bc30124ce6dbca98f98836e8.zip |
Merge pull request #12451 from vrothberg/backport-12064
[v3.4] container create: fix --tls-verify parsing
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/common/create.go | 8 | ||||
-rw-r--r-- | cmd/podman/containers/create.go | 7 |
2 files changed, 9 insertions, 6 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go index 643f6728a..910aae6f0 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -5,6 +5,7 @@ import ( "github.com/containers/common/pkg/auth" "github.com/containers/common/pkg/completion" + commonFlag "github.com/containers/common/pkg/flag" "github.com/containers/podman/v3/cmd/podman/registry" "github.com/containers/podman/v3/libpod/define" "github.com/containers/podman/v3/pkg/domain/entities" @@ -606,12 +607,9 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions, ) _ = cmd.RegisterFlagCompletionFunc(timeoutFlagName, completion.AutocompleteNone) - // Flag for TLS verification, so that `run` and `create` commands can make use of it. - // Make sure to use `=` while using this flag i.e `--tls-verify=false/true` - tlsVerifyFlagName := "tls-verify" - createFlags.BoolVar( + commonFlag.OptionalBoolFlag(createFlags, &cf.TLSVerify, - tlsVerifyFlagName, true, + "tls-verify", "Require HTTPS and verify certificates when contacting registries for pulling images", ) diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go index aa34f9ba5..8bbdfa871 100644 --- a/cmd/podman/containers/create.go +++ b/cmd/podman/containers/create.go @@ -292,6 +292,11 @@ func PullImage(imageName string, cliVals entities.ContainerCreateOptions) (strin } } + skipTLSVerify := types.OptionalBoolUndefined + if cliVals.TLSVerify.Present() { + skipTLSVerify = types.NewOptionalBool(!cliVals.TLSVerify.Value()) + } + pullReport, pullErr := registry.ImageEngine().Pull(registry.GetContext(), imageName, entities.ImagePullOptions{ Authfile: cliVals.Authfile, Quiet: cliVals.Quiet, @@ -300,7 +305,7 @@ func PullImage(imageName string, cliVals entities.ContainerCreateOptions) (strin Variant: cliVals.Variant, SignaturePolicy: cliVals.SignaturePolicy, PullPolicy: pullPolicy, - SkipTLSVerify: types.NewOptionalBool(!cliVals.TLSVerify), // If Flag changed for TLS Verification + SkipTLSVerify: skipTLSVerify, }) if pullErr != nil { return "", pullErr |