mirror of https://github.com/docker/compose.git
Support -H=host notation for interactive run/execs
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
7d68d4bb44
commit
cbb9bff924
|
@ -1418,7 +1418,7 @@ def call_docker(args, dockeropts):
|
|||
if verify:
|
||||
tls_options.append('--tlsverify')
|
||||
if host:
|
||||
tls_options.extend(['--host', host])
|
||||
tls_options.extend(['--host', host.lstrip('=')])
|
||||
|
||||
args = [executable_path] + tls_options + args
|
||||
log.debug(" ".join(map(pipes.quote, args)))
|
||||
|
|
|
@ -177,6 +177,13 @@ class CLITestCase(DockerClientTestCase):
|
|||
returncode=0
|
||||
)
|
||||
|
||||
def test_shorthand_host_opt_interactive(self):
|
||||
self.dispatch(
|
||||
['-H={0}'.format(os.environ.get('DOCKER_HOST', 'unix://')),
|
||||
'run', 'another', 'ls'],
|
||||
returncode=0
|
||||
)
|
||||
|
||||
def test_host_not_reachable(self):
|
||||
result = self.dispatch(['-H=tcp://doesnotexist:8000', 'ps'], returncode=1)
|
||||
assert "Couldn't connect to Docker daemon" in result.stderr
|
||||
|
|
|
@ -154,3 +154,11 @@ class TestCallDocker(object):
|
|||
assert fake_call.call_args[0][0] == [
|
||||
'docker', '--host', 'tcp://mydocker.net:2333', 'ps'
|
||||
]
|
||||
|
||||
def test_with_host_option_shorthand_equal(self):
|
||||
with mock.patch('subprocess.call') as fake_call:
|
||||
call_docker(['ps'], {'--host': '=tcp://mydocker.net:2333'})
|
||||
|
||||
assert fake_call.call_args[0][0] == [
|
||||
'docker', '--host', 'tcp://mydocker.net:2333', 'ps'
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue