diff options
author | Joffrey F <joffrey@docker.com> | 2015-06-18 19:44:58 +0200 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2015-06-18 19:44:58 +0200 |
commit | 6c92431c9ec64ddaee089b3a659ab85ff7257fcd (patch) | |
tree | 929eb7671e30b259b23ef64efcc7cba739800286 | |
parent | be73aaf5401faf5ca64911fb6664036c7b7ec61b (diff) | |
parent | f0a9c80a49ad8fe82f25866c3e444d4b1fe22fd1 (diff) | |
download | docker-py-6c92431c9ec64ddaee089b3a659ab85ff7257fcd.tar.gz |
Merge branch '1.3.0-rc0'
-rw-r--r-- | docker/utils/utils.py | 3 | ||||
-rw-r--r-- | docker/version.py | 4 | ||||
-rw-r--r-- | docs/change_log.md | 33 | ||||
-rw-r--r-- | docs/volumes.md | 13 | ||||
-rw-r--r-- | tests/test.py | 30 |
5 files changed, 81 insertions, 2 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py index e4a3c9e..724af46 100644 --- a/docker/utils/utils.py +++ b/docker/utils/utils.py @@ -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): diff --git a/docker/version.py b/docker/version.py index 7ff5b2a..f47b741 100644 --- a/docker/version.py +++ b/docker/version.py @@ -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(".")]) diff --git a/docs/change_log.md b/docs/change_log.md index 5bbbc93..837655f 100644 --- a/docs/change_log.md +++ b/docs/change_log.md @@ -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 ----- diff --git a/docs/volumes.md b/docs/volumes.md index de28214..db42155 100644 --- a/docs/volumes.md +++ b/docs/volumes.md @@ -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', + ]) +) +``` diff --git a/tests/test.py b/tests/test.py index e0a9e34..97af11e 100644 --- a/tests/test.py +++ b/tests/test.py @@ -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: |