summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/login.go7
-rw-r--r--cmd/podman/logout.go17
2 files changed, 11 insertions, 13 deletions
diff --git a/cmd/podman/login.go b/cmd/podman/login.go
index dc57758ab..8413861f5 100644
--- a/cmd/podman/login.go
+++ b/cmd/podman/login.go
@@ -8,6 +8,7 @@ import (
"github.com/containers/image/v5/types"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/pkg/registries"
"github.com/spf13/cobra"
)
@@ -23,7 +24,7 @@ var (
Short: "Login to a container registry",
Long: "Login to a container registry on a specified server.",
RunE: login,
- Args: cobra.ExactArgs(1),
+ Args: cobra.MaximumNArgs(1),
Example: `podman login quay.io
podman login --username ... --password ... quay.io
podman login --authfile dir/auth.json quay.io`,
@@ -48,6 +49,7 @@ func init() {
flags.BoolVarP(&loginOptions.GetLoginSet, "get-login", "", false, "Return the current login user for the registry")
loginOptions.Stdin = os.Stdin
loginOptions.Stdout = os.Stdout
+ loginOptions.AcceptUnspecifiedRegistry = true
}
// Implementation of podman-login.
@@ -62,7 +64,8 @@ func login(cmd *cobra.Command, args []string) error {
AuthFilePath: loginOptions.AuthFile,
DockerCertPath: loginOptions.CertDir,
DockerInsecureSkipTLSVerify: skipTLS,
+ SystemRegistriesConfPath: registries.SystemRegistriesConfPath(),
}
loginOptions.GetLoginSet = cmd.Flag("get-login").Changed
- return auth.Login(context.Background(), &sysCtx, &loginOptions.LoginOptions, args[0])
+ return auth.Login(context.Background(), &sysCtx, &loginOptions.LoginOptions, args)
}
diff --git a/cmd/podman/logout.go b/cmd/podman/logout.go
index c21711fc0..d0afc21b4 100644
--- a/cmd/podman/logout.go
+++ b/cmd/podman/logout.go
@@ -7,7 +7,7 @@ import (
"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/containers/libpod/pkg/registries"
"github.com/spf13/cobra"
)
@@ -39,19 +39,14 @@ func init() {
flags.AddFlagSet(auth.GetLogoutFlags(&logoutOptions))
logoutOptions.Stdin = os.Stdin
logoutOptions.Stdout = os.Stdout
+ logoutOptions.AcceptUnspecifiedRegistry = true
}
// Implementation of podman-logout.
func logout(cmd *cobra.Command, args []string) error {
- sysCtx := types.SystemContext{AuthFilePath: logoutOptions.AuthFile}
-
- registry := ""
- if len(args) > 0 {
- if logoutOptions.All {
- return errors.New("--all takes no arguments")
- }
- registry = args[0]
+ sysCtx := types.SystemContext{
+ AuthFilePath: logoutOptions.AuthFile,
+ SystemRegistriesConfPath: registries.SystemRegistriesConfPath(),
}
-
- return auth.Logout(&sysCtx, &logoutOptions, registry)
+ return auth.Logout(&sysCtx, &logoutOptions, args)
}