mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
Fix podman push and podman pull to check for authfile
This fixes pull_test.go push_test.go is still broken because of lack of registry support. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -2,11 +2,13 @@ package images
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
buildahcli "github.com/containers/buildah/pkg/cli"
|
buildahcli "github.com/containers/buildah/pkg/cli"
|
||||||
"github.com/containers/image/v5/types"
|
"github.com/containers/image/v5/types"
|
||||||
"github.com/containers/libpod/cmd/podman/registry"
|
"github.com/containers/libpod/cmd/podman/registry"
|
||||||
"github.com/containers/libpod/pkg/domain/entities"
|
"github.com/containers/libpod/pkg/domain/entities"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
@ -99,6 +101,11 @@ func imagePull(cmd *cobra.Command, args []string) error {
|
|||||||
if cmd.Flags().Changed("tls-verify") {
|
if cmd.Flags().Changed("tls-verify") {
|
||||||
pullOptsAPI.TLSVerify = types.NewOptionalBool(pullOptions.TLSVerifyCLI)
|
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
|
// Let's do all the remaining Yoga in the API to prevent us from
|
||||||
// scattering logic across (too) many parts of the code.
|
// scattering logic across (too) many parts of the code.
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package images
|
package images
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
buildahcli "github.com/containers/buildah/pkg/cli"
|
buildahcli "github.com/containers/buildah/pkg/cli"
|
||||||
"github.com/containers/image/v5/types"
|
"github.com/containers/image/v5/types"
|
||||||
"github.com/containers/libpod/cmd/podman/registry"
|
"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)
|
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
|
// Let's do all the remaining Yoga in the API to prevent us from scattering
|
||||||
// logic across (too) many parts of the code.
|
// logic across (too) many parts of the code.
|
||||||
return registry.ImageEngine().Push(registry.GetContext(), source, destination, pushOptsAPI)
|
return registry.ImageEngine().Push(registry.GetContext(), source, destination, pushOptsAPI)
|
||||||
|
@ -22,7 +22,6 @@ var _ = Describe("Podman pull", func() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
Skip(v2fail)
|
|
||||||
tempdir, err = CreateTempDirInTempDir()
|
tempdir, err = CreateTempDirInTempDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
Reference in New Issue
Block a user