File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 88
99 "github.com/containers/common/pkg/auth"
1010 "github.com/containers/common/pkg/completion"
11+ "github.com/containers/image/v5/pkg/sysregistriesv2"
1112 "github.com/containers/image/v5/types"
1213 "github.com/containers/podman/v5/cmd/podman/common"
1314 "github.com/containers/podman/v5/cmd/podman/registry"
@@ -99,6 +100,10 @@ func login(cmd *cobra.Command, args []string) error {
99100 DockerInsecureSkipTLSVerify : skipTLS ,
100101 }
101102 setRegistriesConfPath (sysCtx )
103+ registriesFromFile , _ := sysregistriesv2 .UnqualifiedSearchRegistries (sysCtx )
104+ if len (registriesFromFile ) > 1 {
105+ return errors .New ("multiple registries in registry.conf, a registry must be provided" )
106+ }
102107 loginOptions .GetLoginSet = cmd .Flag ("get-login" ).Changed
103108 return auth .Login (context .Background (), sysCtx , & loginOptions .LoginOptions , args )
104109}
Original file line number Diff line number Diff line change 11package main
22
33import (
4+ "errors"
45 "os"
56
67 "github.com/containers/common/pkg/auth"
78 "github.com/containers/common/pkg/completion"
9+ "github.com/containers/image/v5/pkg/sysregistriesv2"
810 "github.com/containers/image/v5/types"
911 "github.com/containers/podman/v5/cmd/podman/common"
1012 "github.com/containers/podman/v5/cmd/podman/registry"
@@ -50,5 +52,9 @@ func init() {
5052func logout (cmd * cobra.Command , args []string ) error {
5153 sysCtx := & types.SystemContext {}
5254 setRegistriesConfPath (sysCtx )
55+ registriesFromFile , _ := sysregistriesv2 .UnqualifiedSearchRegistries (sysCtx )
56+ if len (registriesFromFile ) > 1 {
57+ return errors .New ("multiple registries in registry.conf, a registry must be provided" )
58+ }
5359 return auth .Logout (sysCtx , & logoutOptions , args )
5460}
You can’t perform that action at this time.
0 commit comments