diff options
| author | Michael Hankin <mjhankin1@gmail.com> | 2017-12-03 14:54:28 -0600 |
|---|---|---|
| committer | Michael Hankin <mjhankin1@gmail.com> | 2017-12-03 14:54:28 -0600 |
| commit | 8d770b012d6786ffb468e0fc929bde309a9500b1 (patch) | |
| tree | 7efa1be41fa7178922efe01f45763f19d472fcf0 | |
| parent | 94e3d3dcb9d75d2302c5946d83ecae1e54a3b7c9 (diff) | |
| download | docker-py-8d770b012d6786ffb468e0fc929bde309a9500b1.tar.gz | |
Change format of extra hosts
Signed-off-by: Michael Hankin <mjhankin1@gmail.com>
| -rw-r--r-- | docker/utils/utils.py | 2 | ||||
| -rw-r--r-- | tests/integration/api_service_test.py | 4 | ||||
| -rw-r--r-- | tests/unit/models_containers_test.py | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py index a123fd8..3e2a710 100644 --- a/docker/utils/utils.py +++ b/docker/utils/utils.py @@ -566,7 +566,7 @@ def format_environment(environment): def format_extra_hosts(extra_hosts): return [ - '{}:{}'.format(k, v) for k, v in sorted(six.iteritems(extra_hosts)) + '{} {}'.format(v, k) for k, v in sorted(six.iteritems(extra_hosts)) ] diff --git a/tests/integration/api_service_test.py b/tests/integration/api_service_test.py index b931154..05b5ba7 100644 --- a/tests/integration/api_service_test.py +++ b/tests/integration/api_service_test.py @@ -588,8 +588,8 @@ class ServiceTest(BaseAPIIntegrationTest): assert 'Hosts' in svc_info['Spec']['TaskTemplate']['ContainerSpec'] hosts = svc_info['Spec']['TaskTemplate']['ContainerSpec']['Hosts'] assert len(hosts) == 2 - assert 'foobar:127.0.0.1' in hosts - assert 'baz:8.8.8.8' in hosts + assert '127.0.0.1 foobar' in hosts + assert '8.8.8.8 baz' in hosts @requires_api_version('1.25') def test_create_service_with_hostname(self): diff --git a/tests/unit/models_containers_test.py b/tests/unit/models_containers_test.py index 5eaa45a..29a5caa 100644 --- a/tests/unit/models_containers_test.py +++ b/tests/unit/models_containers_test.py @@ -141,7 +141,7 @@ class ContainerCollectionTest(unittest.TestCase): 'Dns': ['8.8.8.8'], 'DnsOptions': ['foo'], 'DnsSearch': ['example.com'], - 'ExtraHosts': ['foo:1.2.3.4'], + 'ExtraHosts': ['1.2.3.4 foo'], 'GroupAdd': ['blah'], 'IpcMode': 'foo', 'KernelMemory': 123, |
