summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2021-10-21 20:26:05 +0200
committerMiloslav Trmač <mitr@redhat.com>2021-12-10 18:16:26 +0100
commitd79414c54ff89c3deea84e2ac600525744fc75c5 (patch)
tree93f85de0a3b9ede16fb717d6e5b8a511cd966d72
parentf9be3262740a2961f5c1a4db24265234a3fc6a5f (diff)
downloadpodman-d79414c54ff89c3deea84e2ac600525744fc75c5.tar.gz
podman-d79414c54ff89c3deea84e2ac600525744fc75c5.tar.bz2
podman-d79414c54ff89c3deea84e2ac600525744fc75c5.zip
Simplify the header decision in pkg/bindings/images.Build a bit
... now that two of the three cases are the same. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-rw-r--r--pkg/bindings/images/build.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index 54c831c36..fece5e9d0 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -293,14 +293,10 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
headers map[string]string
err error
)
- if options.SystemContext == nil {
- headers, err = auth.MakeXRegistryConfigHeader(options.SystemContext, "", "")
+ if options.SystemContext != nil && options.SystemContext.DockerAuthConfig != nil {
+ headers, err = auth.MakeXRegistryAuthHeader(options.SystemContext, options.SystemContext.AuthFilePath, options.SystemContext.DockerAuthConfig.Username, options.SystemContext.DockerAuthConfig.Password)
} else {
- if options.SystemContext.DockerAuthConfig != nil {
- headers, err = auth.MakeXRegistryAuthHeader(options.SystemContext, options.SystemContext.AuthFilePath, options.SystemContext.DockerAuthConfig.Username, options.SystemContext.DockerAuthConfig.Password)
- } else {
- headers, err = auth.MakeXRegistryConfigHeader(options.SystemContext, "", "")
- }
+ headers, err = auth.MakeXRegistryConfigHeader(options.SystemContext, "", "")
}
if err != nil {
return nil, err