Skip to content

Commit 1c1d7ee

Browse files
committed
Merge branch 'master' into exec_create_user
2 parents 2febf10 + c697f0c commit 1c1d7ee

22 files changed

+840
-439
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM python:2.7
2-
MAINTAINER Joffrey F <joffrey@dotcloud.com>
2+
MAINTAINER Joffrey F <joffrey@docker.com>
33
ADD . /home/docker-py
44
WORKDIR /home/docker-py
55
RUN pip install -r test-requirements.txt

Dockerfile-py3

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM python:3.4
2+
MAINTAINER Joffrey F <[email protected]>
3+
ADD . /home/docker-py
4+
WORKDIR /home/docker-py
5+
RUN pip install -r test-requirements.txt
6+
RUN pip install .

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all build test integration-test unit-test
1+
.PHONY: all build test integration-test unit-test build-py3 unit-test-py3 integration-test-py3
22

33
HOST_TMPDIR=test -n "$(TMPDIR)" && echo $(TMPDIR) || echo /tmp
44

@@ -7,10 +7,19 @@ all: test
77
build:
88
docker build -t docker-py .
99

10-
test: unit-test integration-test
10+
build-py3:
11+
docker build -t docker-py3 -f Dockerfile-py3 .
12+
13+
test: unit-test integration-test unit-test-py3 integration-test-py3
1114

1215
unit-test: build
1316
docker run docker-py python tests/test.py
1417

18+
unit-test-py3: build-py3
19+
docker run docker-py3 python tests/test.py
20+
1521
integration-test: build
1622
docker run -e NOT_ON_HOST=true -v `$(HOST_TMPDIR)`:/tmp -v /var/run/docker.sock:/var/run/docker.sock docker-py python tests/integration_test.py
23+
24+
integration-test-py3: build-py3
25+
docker run -e NOT_ON_HOST=true -v `$(HOST_TMPDIR)`:/tmp -v /var/run/docker.sock:/var/run/docker.sock docker-py3 python tests/integration_test.py

docker/auth/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .auth import (
2+
INDEX_NAME,
23
INDEX_URL,
34
encode_header,
45
load_config,

docker/auth/auth.py

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,34 @@
1616
import fileinput
1717
import json
1818
import os
19+
import warnings
1920

2021
import six
2122

22-
from ..utils import utils
23+
from .. import constants
2324
from .. import errors
2425

25-
INDEX_URL = 'https://index.docker.io/v1/'
26+
INDEX_NAME = 'index.docker.io'
27+
INDEX_URL = 'https://{0}/v1/'.format(INDEX_NAME)
2628
DOCKER_CONFIG_FILENAME = os.path.join('.docker', 'config.json')
2729
LEGACY_DOCKER_CONFIG_FILENAME = '.dockercfg'
2830

2931

30-
def expand_registry_url(hostname, insecure=False):
31-
if hostname.startswith('http:') or hostname.startswith('https:'):
32-
return hostname
33-
if utils.ping_registry('https://' + hostname):
34-
return 'https://' + hostname
35-
elif insecure:
36-
return 'http://' + hostname
37-
else:
38-
raise errors.DockerException(
39-
"HTTPS endpoint unresponsive and insecure mode isn't enabled."
32+
def resolve_repository_name(repo_name, insecure=False):
33+
if insecure:
34+
warnings.warn(
35+
constants.INSECURE_REGISTRY_DEPRECATION_WARNING.format(
36+
'resolve_repository_name()'
37+
), DeprecationWarning
4038
)
4139

42-
43-
def resolve_repository_name(repo_name, insecure=False):
4440
if '://' in repo_name:
4541
raise errors.InvalidRepository(
4642
'Repository name cannot contain a scheme ({0})'.format(repo_name))
4743
parts = repo_name.split('/', 1)
4844
if '.' not in parts[0] and ':' not in parts[0] and parts[0] != 'localhost':
4945
# This is a docker index repo (ex: foo/bar or ubuntu)
50-
return INDEX_URL, repo_name
46+
return INDEX_NAME, repo_name
5147
if len(parts) < 2:
5248
raise errors.InvalidRepository(
5349
'Invalid repository name ({0})'.format(repo_name))
@@ -57,7 +53,7 @@ def resolve_repository_name(repo_name, insecure=False):
5753
'Invalid repository name, try "{0}" instead'.format(parts[1])
5854
)
5955

60-
return expand_registry_url(parts[0], insecure), parts[1]
56+
return parts[0], parts[1]
6157

6258

6359
def resolve_authconfig(authconfig, registry=None):
@@ -68,7 +64,7 @@ def resolve_authconfig(authconfig, registry=None):
6864
Returns None if no match was found.
6965
"""
7066
# Default to the public index server
71-
registry = convert_to_hostname(registry) if registry else INDEX_URL
67+
registry = convert_to_hostname(registry) if registry else INDEX_NAME
7268

7369
if registry in authconfig:
7470
return authconfig[registry]
@@ -102,12 +98,6 @@ def encode_header(auth):
10298
return base64.b64encode(auth_json)
10399

104100

105-
def encode_full_header(auth):
106-
""" Returns the given auth block encoded for the X-Registry-Config header.
107-
"""
108-
return encode_header({'configs': auth})
109-
110-
111101
def parse_auth(entries):
112102
"""
113103
Parses authentication entries
@@ -185,7 +175,7 @@ def load_config(config_path=None):
185175
'Invalid or empty configuration file!')
186176

187177
username, password = decode_auth(data[0])
188-
conf[INDEX_URL] = {
178+
conf[INDEX_NAME] = {
189179
'username': username,
190180
'password': password,
191181
'email': data[1],

0 commit comments

Comments
 (0)