From f692261ea01032ffc6bdc55a6cd1794928dd89cf Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 5 May 2019 12:13:55 +0200 Subject: [PATCH] oom_killer and oom_score_adj are available since docker-py 1.8.0. (#56012) * oom_killer and oom_score_adj are available since docker-py 1.8.0. * Add changelog. --- .../56012-docker_container-oom-version.yml | 2 ++ .../modules/cloud/docker/docker_container.py | 3 +-- .../docker_container/tasks/tests/options.yml | 18 ------------------ 3 files changed, 3 insertions(+), 20 deletions(-) create mode 100644 changelogs/fragments/56012-docker_container-oom-version.yml diff --git a/changelogs/fragments/56012-docker_container-oom-version.yml b/changelogs/fragments/56012-docker_container-oom-version.yml new file mode 100644 index 0000000000..964958c93a --- /dev/null +++ b/changelogs/fragments/56012-docker_container-oom-version.yml @@ -0,0 +1,2 @@ +bugfixes: +- "docker_container - ``oom_killer`` and ``oom_score_adj`` options are available since docker-py 1.8.0, not 2.0.0 as assumed by the version check." diff --git a/lib/ansible/modules/cloud/docker/docker_container.py b/lib/ansible/modules/cloud/docker/docker_container.py index b783ce5a77..bd9ce30299 100644 --- a/lib/ansible/modules/cloud/docker/docker_container.py +++ b/lib/ansible/modules/cloud/docker/docker_container.py @@ -2844,8 +2844,7 @@ class AnsibleDockerClientContainer(AnsibleDockerClient): dns_opts=dict(docker_api_version='1.21', docker_py_version='1.10.0'), ipc_mode=dict(docker_api_version='1.25'), mac_address=dict(docker_api_version='1.25'), - oom_killer=dict(docker_py_version='2.0.0'), - oom_score_adj=dict(docker_api_version='1.22', docker_py_version='2.0.0'), + oom_score_adj=dict(docker_api_version='1.22'), shm_size=dict(docker_api_version='1.22'), stop_signal=dict(docker_api_version='1.21'), tmpfs=dict(docker_api_version='1.22'), diff --git a/test/integration/targets/docker_container/tasks/tests/options.yml b/test/integration/targets/docker_container/tasks/tests/options.yml index 41e954d79a..cb3c901657 100644 --- a/test/integration/targets/docker_container/tasks/tests/options.yml +++ b/test/integration/targets/docker_container/tasks/tests/options.yml @@ -2438,7 +2438,6 @@ avoid such warnings, please quote the value.' in log_options_2.warnings" oom_killer: yes state: started register: oom_killer_1 - ignore_errors: yes - name: oom_killer (idempotency) docker_container: @@ -2448,7 +2447,6 @@ avoid such warnings, please quote the value.' in log_options_2.warnings" oom_killer: yes state: started register: oom_killer_2 - ignore_errors: yes - name: oom_killer (change) docker_container: @@ -2459,7 +2457,6 @@ avoid such warnings, please quote the value.' in log_options_2.warnings" state: started force_kill: yes register: oom_killer_3 - ignore_errors: yes - name: cleanup docker_container: @@ -2473,12 +2470,6 @@ avoid such warnings, please quote the value.' in log_options_2.warnings" - oom_killer_1 is changed - oom_killer_2 is not changed - oom_killer_3 is changed - when: docker_py_version is version('2.0.0', '>=') -- assert: - that: - - oom_killer_1 is failed - - "('version is ' ~ docker_py_version ~'. Minimum version required is 2.0.0') in oom_killer_1.msg" - when: docker_py_version is version('2.0.0', '<') #################################################################### ## oom_score_adj ################################################### @@ -2492,7 +2483,6 @@ avoid such warnings, please quote the value.' in log_options_2.warnings" oom_score_adj: 5 state: started register: oom_score_adj_1 - ignore_errors: yes - name: oom_score_adj (idempotency) docker_container: @@ -2502,7 +2492,6 @@ avoid such warnings, please quote the value.' in log_options_2.warnings" oom_score_adj: 5 state: started register: oom_score_adj_2 - ignore_errors: yes - name: oom_score_adj (change) docker_container: @@ -2513,7 +2502,6 @@ avoid such warnings, please quote the value.' in log_options_2.warnings" state: started force_kill: yes register: oom_score_adj_3 - ignore_errors: yes - name: cleanup docker_container: @@ -2527,12 +2515,6 @@ avoid such warnings, please quote the value.' in log_options_2.warnings" - oom_score_adj_1 is changed - oom_score_adj_2 is not changed - oom_score_adj_3 is changed - when: docker_py_version is version('2.0.0', '>=') -- assert: - that: - - oom_score_adj_1 is failed - - "('version is ' ~ docker_py_version ~'. Minimum version required is 2.0.0') in oom_score_adj_1.msg" - when: docker_py_version is version('2.0.0', '<') #################################################################### ## output_logs #####################################################