mirror of https://github.com/containers/podman.git
push: fix --tls-verify
Fix --tls-verify parsing and make the associated options reflect the correct logic. Other commands are affected as well but will be fixed later. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
parent
46b185942c
commit
d6d1e3860c
|
@ -113,7 +113,7 @@ func imagePush(cmd *cobra.Command, args []string) error {
|
|||
// which is important to implement a sane way of dealing with defaults of
|
||||
// boolean CLI flags.
|
||||
if cmd.Flags().Changed("tls-verify") {
|
||||
pushOptions.TLSVerify = types.NewOptionalBool(pushOptions.TLSVerifyCLI)
|
||||
pushOptions.SkipTLSVerify = types.NewOptionalBool(!pushOptions.TLSVerifyCLI)
|
||||
}
|
||||
|
||||
if pushOptions.Authfile != "" {
|
||||
|
|
|
@ -310,9 +310,9 @@ func Push(ctx context.Context, source string, destination string, options entiti
|
|||
params := url.Values{}
|
||||
params.Set("credentials", options.Credentials)
|
||||
params.Set("destination", destination)
|
||||
if options.TLSVerify != types.OptionalBoolUndefined {
|
||||
val := bool(options.TLSVerify == types.OptionalBoolTrue)
|
||||
params.Set("tlsVerify", strconv.FormatBool(val))
|
||||
if options.SkipTLSVerify != types.OptionalBoolUndefined {
|
||||
val := bool(options.SkipTLSVerify == types.OptionalBoolTrue)
|
||||
params.Set("tlsVerify", strconv.FormatBool(!val))
|
||||
}
|
||||
|
||||
path := fmt.Sprintf("/images/%s/push", source)
|
||||
|
|
|
@ -183,8 +183,8 @@ type ImagePushOptions struct {
|
|||
// SignBy adds a signature at the destination using the specified key.
|
||||
// Ignored for remote calls.
|
||||
SignBy string
|
||||
// TLSVerify to enable/disable HTTPS and certificate verification.
|
||||
TLSVerify types.OptionalBool
|
||||
// SkipTLSVerify to skip HTTPS and certificate verification.
|
||||
SkipTLSVerify types.OptionalBool
|
||||
}
|
||||
|
||||
// ImageSearchOptions are the arguments for searching images.
|
||||
|
|
|
@ -221,7 +221,7 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri
|
|||
dockerRegistryOptions := image.DockerRegistryOptions{
|
||||
DockerRegistryCreds: registryCreds,
|
||||
DockerCertPath: options.CertDir,
|
||||
DockerInsecureSkipTLSVerify: options.TLSVerify,
|
||||
DockerInsecureSkipTLSVerify: options.SkipTLSVerify,
|
||||
}
|
||||
|
||||
signOptions := image.SigningOptions{
|
||||
|
|
Loading…
Reference in New Issue