Merge branch '1.3.0-rc0'

This commit is contained in:
Joffrey F 2015-06-18 19:44:58 +02:00
commit 6c92431c9e
5 changed files with 81 additions and 2 deletions

View File

@ -174,6 +174,9 @@ def convert_port_bindings(port_bindings):
def convert_volume_binds(binds):
if isinstance(binds, list):
return binds
result = []
for k, v in binds.items():
if isinstance(v, dict):

View File

@ -1,2 +1,2 @@
version = "1.2.3-dev"
version_info = tuple([int(d) for d in version.replace("-dev", "").split(".")])
version = "1.2.3-rc1"
version_info = tuple([int(d) for d in version.split("-")[0].split(".")])

View File

@ -1,6 +1,39 @@
Change Log
==========
1.2.3
-----
[List of PRs / issues for this release](https://github.com/docker/docker-py/issues?q=milestone%3A1.2.3+is%3Aclosed)
### Deprecation warning
* Passing host config in the `Client.start` method is now deprecated. Please use the
`host_config` in `Client.create_container` instead.
### Features
* Added support for `privileged` param in `Client.exec_create`
(only available in API >= 1.19)
### Bugfixes
* Fixed a bug where the `read_only` param in host_config wasn't handled
properly.
* Fixed a bug in `Client.execute` (this method is still deprecated).
* The `cpuset` param in `Client.create_container` is also passed as
the `CpusetCpus` param (`Cpuset` deprecated in recent versions of the API)
* Fixed an issue with integration tests being run inside a container
(`make integration-test`)
* Fixed a bug where an empty string would be considered a valid container ID
or image ID.
* Fixed a bug in `Client.insert`
### Documentation
* Various fixes
1.2.2
-----

View File

@ -19,3 +19,16 @@ container_id = c.create_container(
})
)
```
You can alternatively specify binds as a list. This code is equivalent to the
example above:
```python
container_id = c.create_container(
'busybox', 'ls', volumes=['/mnt/vol1', '/mnt/vol2'],
host_config=docker.utils.create_host_config(binds=[
'/home/user1/:/mnt/vol2',
'/var/www:/mnt/vol1:ro',
])
)
```

View File

@ -808,6 +808,36 @@ class DockerClientTest(Cleanup, base.BaseTestCase):
DEFAULT_TIMEOUT_SECONDS
)
def test_create_container_with_binds_list(self):
try:
self.client.create_container(
'busybox', 'true', host_config=create_host_config(
binds=[
"/tmp:/mnt/1:ro",
"/tmp:/mnt/2",
],
)
)
except Exception as e:
self.fail('Command should not raise exception: {0}'.format(e))
args = fake_request.call_args
self.assertEqual(args[0][0], url_prefix +
'containers/create')
expected_payload = self.base_create_payload()
expected_payload['HostConfig'] = create_host_config()
expected_payload['HostConfig']['Binds'] = [
"/tmp:/mnt/1:ro",
"/tmp:/mnt/2",
]
self.assertEqual(json.loads(args[1]['data']), expected_payload)
self.assertEqual(args[1]['headers'],
{'Content-Type': 'application/json'})
self.assertEqual(
args[1]['timeout'],
DEFAULT_TIMEOUT_SECONDS
)
def test_create_container_with_port_binds(self):
self.maxDiff = None
try: