[2.7] docker_container: fix support for docker-py 1.7.0 (#55496)

* In theory, some 2.7 modules support docker-py 1.7.0.

* Add changelog.
pull/55714/head
Felix Fontein 6 years ago committed by Toshio Kuratomi
parent e51edbfa1e
commit ed1640e9dc

@ -0,0 +1,2 @@
bugfixes:
- "docker_container - make again compatible with docker-py 1.7.0."

@ -991,12 +991,14 @@ class TaskParameters(DockerBaseClass):
group_add='groups', group_add='groups',
devices='devices', devices='devices',
pid_mode='pid_mode', pid_mode='pid_mode',
tmpfs='tmpfs',
init='init', init='init',
uts_mode='uts', uts_mode='uts',
auto_remove='auto_remove', auto_remove='auto_remove',
) )
if self.client.docker_py_version >= LooseVersion('1.8'):
host_config_params['tmpfs'] = 'tmpfs'
if self.client.docker_py_version >= LooseVersion('1.9') and self.client.docker_api_version >= LooseVersion('1.22'): if self.client.docker_py_version >= LooseVersion('1.9') and self.client.docker_api_version >= LooseVersion('1.22'):
# blkio_weight can always be updated, but can only be set on creation # blkio_weight can always be updated, but can only be set on creation
# when docker-py and docker API are new enough # when docker-py and docker API are new enough
@ -2267,7 +2269,7 @@ class AnsibleDockerClientContainer(AnsibleDockerClient):
oom_score_adj=dict(docker_api_version='1.22', docker_py_version='2.0.0'), oom_score_adj=dict(docker_api_version='1.22', docker_py_version='2.0.0'),
shm_size=dict(docker_api_version='1.22'), shm_size=dict(docker_api_version='1.22'),
stop_signal=dict(docker_api_version='1.21'), stop_signal=dict(docker_api_version='1.21'),
tmpfs=dict(docker_api_version='1.22'), tmpfs=dict(docker_api_version='1.22', docker_py_version='1.8.0'),
volume_driver=dict(docker_api_version='1.21'), volume_driver=dict(docker_api_version='1.21'),
memory_reservation=dict(docker_api_version='1.21'), memory_reservation=dict(docker_api_version='1.21'),
kernel_memory=dict(docker_api_version='1.21'), kernel_memory=dict(docker_api_version='1.21'),

@ -30,7 +30,7 @@
with_items: "{{ dnetworks }}" with_items: "{{ dnetworks }}"
when: docker_py_version is version('1.10.0', '>=') when: docker_py_version is version('1.10.0', '>=')
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=') when: docker_py_version is version('1.7.0', '>=') and docker_api_version is version('1.20', '>=')
- fail: msg="Too old docker / docker-py version to run all docker_container tests!" - fail: msg="Too old docker / docker-py version to run all docker_container tests!"
when: not(docker_py_version is version('3.5.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6) when: not(docker_py_version is version('3.5.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)

@ -47,7 +47,7 @@
stop_timeout: 1 stop_timeout: 1
with_items: "{{ cnames }}" with_items: "{{ cnames }}"
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=') when: docker_py_version is version('1.7.0', '>=') and docker_api_version is version('1.20', '>=')
- fail: msg="Too old docker / docker-py version to run docker_image tests!" - fail: msg="Too old docker / docker-py version to run docker_image tests!"
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6) when: not(docker_py_version is version('1.7.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)

@ -48,7 +48,7 @@
- "'hello-world:latest' in result.images[0].RepoTags" - "'hello-world:latest' in result.images[0].RepoTags"
- "'alpine:3.8' in result.images[1].RepoTags" - "'alpine:3.8' in result.images[1].RepoTags"
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=') when: docker_py_version is version('1.7.0', '>=') and docker_api_version is version('1.20', '>=')
- fail: msg="Too old docker / docker-py version to run docker_image_facts tests!" - fail: msg="Too old docker / docker-py version to run docker_image_facts tests!"
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6) when: not(docker_py_version is version('1.7.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)

@ -27,7 +27,7 @@
force: yes force: yes
loop: "{{ dnetworks }}" loop: "{{ dnetworks }}"
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.20', '>=') # FIXME: find out API version! when: docker_py_version is version('1.7.0', '>=') and docker_api_version is version('1.20', '>=') # FIXME: find out API version!
- fail: msg="Too old docker / docker-py version to run docker_network tests!" - fail: msg="Too old docker / docker-py version to run docker_network tests!"
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6) when: not(docker_py_version is version('1.7.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)

Loading…
Cancel
Save