diff options
| author | Aanand Prasad <aanand.prasad@gmail.com> | 2015-03-20 14:26:10 -0700 |
|---|---|---|
| committer | Aanand Prasad <aanand.prasad@gmail.com> | 2015-03-20 15:42:10 -0700 |
| commit | bd72bd13c7a49f69dcacfdf655c15b5be2aaa2ad (patch) | |
| tree | 08774701b8f061470cb4fa8282cc94979b092f37 /docker/utils/utils.py | |
| parent | 014dba284198e97925223bb95172281d7dd4e3e0 (diff) | |
| download | docker-py-bd72bd13c7a49f69dcacfdf655c15b5be2aaa2ad.tar.gz | |
Finish labels implementation, add tests and docs
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
Diffstat (limited to 'docker/utils/utils.py')
| -rw-r--r-- | docker/utils/utils.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py index 403296b..63cd2a7 100644 --- a/docker/utils/utils.py +++ b/docker/utils/utils.py @@ -454,14 +454,13 @@ def create_container_config( for k, v in six.iteritems(environment) ] - if isinstance(labels, six.string_types): - labels = [labels, ] + if labels is not None and compare_version('1.18', version) < 0: + raise errors.DockerException( + 'labels were only introduced in API version 1.18' + ) if isinstance(labels, list): - labels_dict = {} - for lbl in labels: - labels_dict[lbl] = {} - labels = labels_dict + labels = dict((lbl, six.text_type('')) for lbl in labels) if isinstance(mem_limit, six.string_types): mem_limit = parse_bytes(mem_limit) |
