summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-22 21:26:42 +0200
committerGitHub <noreply@github.com>2020-04-22 21:26:42 +0200
commit94dc39a41b3a6600e2d07c7c8681b90799d773de (patch)
treea106f234bd694b52f9f3527f53da4ae39259ed33
parentcac05c85887accb71763f7b21a189a14426f4cb4 (diff)
parentae1731e03fa13cfaa6d4c244dcb7827c000617e2 (diff)
downloadpodman-94dc39a41b3a6600e2d07c7c8681b90799d773de.tar.gz
podman-94dc39a41b3a6600e2d07c7c8681b90799d773de.tar.bz2
podman-94dc39a41b3a6600e2d07c7c8681b90799d773de.zip
Merge pull request #5945 from rhatdan/pull
Fix podman push and podman pull to check for authfile
-rw-r--r--cmd/podman/images/pull.go7
-rw-r--r--cmd/podman/images/push.go8
-rw-r--r--test/e2e/pull_test.go1
3 files changed, 15 insertions, 1 deletions
diff --git a/cmd/podman/images/pull.go b/cmd/podman/images/pull.go
index fb107d00c..f996d0681 100644
--- a/cmd/podman/images/pull.go
+++ b/cmd/podman/images/pull.go
@@ -2,11 +2,13 @@ package images
import (
"fmt"
+ "os"
buildahcli "github.com/containers/buildah/pkg/cli"
"github.com/containers/image/v5/types"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
+ "github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
@@ -99,6 +101,11 @@ func imagePull(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("tls-verify") {
pullOptsAPI.TLSVerify = types.NewOptionalBool(pullOptions.TLSVerifyCLI)
}
+ if pullOptsAPI.Authfile != "" {
+ if _, err := os.Stat(pullOptsAPI.Authfile); err != nil {
+ return errors.Wrapf(err, "error getting authfile %s", pullOptsAPI.Authfile)
+ }
+ }
// Let's do all the remaining Yoga in the API to prevent us from
// scattering logic across (too) many parts of the code.
diff --git a/cmd/podman/images/push.go b/cmd/podman/images/push.go
index f12a5ac86..ef2ffd0d7 100644
--- a/cmd/podman/images/push.go
+++ b/cmd/podman/images/push.go
@@ -1,6 +1,8 @@
package images
import (
+ "os"
+
buildahcli "github.com/containers/buildah/pkg/cli"
"github.com/containers/image/v5/types"
"github.com/containers/libpod/cmd/podman/registry"
@@ -114,6 +116,12 @@ func imagePush(cmd *cobra.Command, args []string) error {
pushOptsAPI.TLSVerify = types.NewOptionalBool(pushOptions.TLSVerifyCLI)
}
+ if pushOptsAPI.Authfile != "" {
+ if _, err := os.Stat(pushOptsAPI.Authfile); err != nil {
+ return errors.Wrapf(err, "error getting authfile %s", pushOptsAPI.Authfile)
+ }
+ }
+
// Let's do all the remaining Yoga in the API to prevent us from scattering
// logic across (too) many parts of the code.
return registry.ImageEngine().Push(registry.GetContext(), source, destination, pushOptsAPI)
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index 153195825..96340ef30 100644
--- a/test/e2e/pull_test.go
+++ b/test/e2e/pull_test.go
@@ -22,7 +22,6 @@ var _ = Describe("Podman pull", func() {
)
BeforeEach(func() {
- Skip(v2fail)
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)