From d6d1e3860c2dec64471d3d9b408e5b90b3c21e4d Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 29 Apr 2020 14:33:00 +0200 Subject: 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 --- pkg/bindings/images/images.go | 6 +++--- pkg/domain/entities/images.go | 4 ++-- pkg/domain/infra/abi/images.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'pkg') diff --git a/pkg/bindings/images/images.go b/pkg/bindings/images/images.go index 2305e0101..ff49ca914 100644 --- a/pkg/bindings/images/images.go +++ b/pkg/bindings/images/images.go @@ -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) diff --git a/pkg/domain/entities/images.go b/pkg/domain/entities/images.go index 707937a44..442b2cf3c 100644 --- a/pkg/domain/entities/images.go +++ b/pkg/domain/entities/images.go @@ -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. diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index 7c63276e5..d1245a45c 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -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{ -- cgit v1.2.3-54-g00ecf From 5c108f75ebdf4bf9214504f8b170ffabff1a38d4 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 29 Apr 2020 14:42:30 +0200 Subject: login system test: enable "push ok" Signed-off-by: Valentin Rothberg --- pkg/bindings/images/images.go | 5 +++-- test/system/150-login.bats | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'pkg') diff --git a/pkg/bindings/images/images.go b/pkg/bindings/images/images.go index ff49ca914..63fe2556b 100644 --- a/pkg/bindings/images/images.go +++ b/pkg/bindings/images/images.go @@ -311,8 +311,9 @@ func Push(ctx context.Context, source string, destination string, options entiti params.Set("credentials", options.Credentials) params.Set("destination", destination) if options.SkipTLSVerify != types.OptionalBoolUndefined { - val := bool(options.SkipTLSVerify == types.OptionalBoolTrue) - params.Set("tlsVerify", strconv.FormatBool(!val)) + // Note: we have to verify if skipped is false. + verifyTLS := bool(options.SkipTLSVerify == types.OptionalBoolFalse) + params.Set("tlsVerify", strconv.FormatBool(verifyTLS)) } path := fmt.Sprintf("/images/%s/push", source) diff --git a/test/system/150-login.bats b/test/system/150-login.bats index 3edb11c2f..a6f9aab85 100644 --- a/test/system/150-login.bats +++ b/test/system/150-login.bats @@ -166,8 +166,6 @@ function setup() { # Some push tests @test "podman push fail" { - skip "Not working for v2 yet" - # Create an invalid authfile authfile=${PODMAN_LOGIN_WORKDIR}/auth-$(random_string 10).json rm -f $authfile -- cgit v1.2.3-54-g00ecf