mirror of https://github.com/docker/compose.git
Handle new pull failures behavior in Engine 1.13
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
70e90a07d3
commit
7e40754ffc
|
@ -10,6 +10,7 @@ from operator import attrgetter
|
||||||
import enum
|
import enum
|
||||||
import six
|
import six
|
||||||
from docker.errors import APIError
|
from docker.errors import APIError
|
||||||
|
from docker.errors import NotFound
|
||||||
from docker.utils import LogConfig
|
from docker.utils import LogConfig
|
||||||
from docker.utils.ports import build_port_bindings
|
from docker.utils.ports import build_port_bindings
|
||||||
from docker.utils.ports import split_port
|
from docker.utils.ports import split_port
|
||||||
|
@ -829,12 +830,11 @@ class Service(object):
|
||||||
repo, tag, separator = parse_repository_tag(self.options['image'])
|
repo, tag, separator = parse_repository_tag(self.options['image'])
|
||||||
tag = tag or 'latest'
|
tag = tag or 'latest'
|
||||||
log.info('Pulling %s (%s%s%s)...' % (self.name, repo, separator, tag))
|
log.info('Pulling %s (%s%s%s)...' % (self.name, repo, separator, tag))
|
||||||
output = self.client.pull(repo, tag=tag, stream=True)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
output = self.client.pull(repo, tag=tag, stream=True)
|
||||||
return progress_stream.get_digest_from_pull(
|
return progress_stream.get_digest_from_pull(
|
||||||
stream_output(output, sys.stdout))
|
stream_output(output, sys.stdout))
|
||||||
except StreamOutputError as e:
|
except (StreamOutputError, NotFound) as e:
|
||||||
if not ignore_pull_failures:
|
if not ignore_pull_failures:
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -330,12 +330,13 @@ class CLITestCase(DockerClientTestCase):
|
||||||
def test_pull_with_ignore_pull_failures(self):
|
def test_pull_with_ignore_pull_failures(self):
|
||||||
result = self.dispatch([
|
result = self.dispatch([
|
||||||
'-f', 'ignore-pull-failures.yml',
|
'-f', 'ignore-pull-failures.yml',
|
||||||
'pull', '--ignore-pull-failures'])
|
'pull', '--ignore-pull-failures']
|
||||||
|
)
|
||||||
|
|
||||||
assert 'Pulling simple (busybox:latest)...' in result.stderr
|
assert 'Pulling simple (busybox:latest)...' in result.stderr
|
||||||
assert 'Pulling another (nonexisting-image:latest)...' in result.stderr
|
assert 'Pulling another (nonexisting-image:latest)...' in result.stderr
|
||||||
assert 'Error: image library/nonexisting-image' in result.stderr
|
assert ('repository nonexisting-image not found' in result.stderr or
|
||||||
assert 'not found' in result.stderr
|
'image library/nonexisting-image:latest not found' in result.stderr)
|
||||||
|
|
||||||
def test_build_plain(self):
|
def test_build_plain(self):
|
||||||
self.base_dir = 'tests/fixtures/simple-dockerfile'
|
self.base_dir = 'tests/fixtures/simple-dockerfile'
|
||||||
|
|
Loading…
Reference in New Issue