Skip to content

Commit f8ad2da

Browse files
committed
Merge pull request #682 from docker/moutten-fix-build-auth
Switch to send full AuthConfig object for build action
2 parents 8a87001 + 4be2286 commit f8ad2da

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

docker/auth/auth.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,6 @@ def encode_header(auth):
9898
return base64.b64encode(auth_json)
9999

100100

101-
def encode_full_header(auth):
102-
""" Returns the given auth block encoded for the X-Registry-Config header.
103-
"""
104-
return encode_header({'configs': auth})
105-
106-
107101
def parse_auth(entries):
108102
"""
109103
Parses authentication entries

docker/client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,14 @@ def build(self, path=None, tag=None, quiet=False, fileobj=None,
140140
if self._auth_configs:
141141
if headers is None:
142142
headers = {}
143-
headers['X-Registry-Config'] = auth.encode_full_header(
144-
self._auth_configs
145-
)
143+
if utils.compare_version('1.19', self._version) >= 0:
144+
headers['X-Registry-Config'] = auth.encode_header(
145+
self._auth_configs
146+
)
147+
else:
148+
headers['X-Registry-Config'] = auth.encode_header({
149+
'configs': self._auth_configs
150+
})
146151

147152
response = self._post(
148153
u,

0 commit comments

Comments
 (0)