docker_container: ambiguous parameter "stop_timeout" (#43874)

* docker_container: Honour stop_timeout when creating docker containers (#43814)

* Adjusting description to what actually happens.

See docker-py changelog for 2.7.0: 'APIClient.stop will
no longer override the stop_timeout value present in the
container’s configuration.'

* Add a test whether stop_timeout can be configured for the container.

* Added changelog.

* Integrate with comparisons (by default, ignore stop_timeout value for restarts; will be configurable with PR ansible/ansible#44789).

* Fix config change code and tests (#2)

* Improving wildcard test.
* Using correct config.
This commit is contained in:
Remo Wenger 2018-09-30 13:03:53 +02:00 committed by John R Barker
commit 83e584577a
4 changed files with 83 additions and 3 deletions

View file

@ -381,6 +381,7 @@
name: "{{ cname }}"
state: started
hostname: example.com
stop_timeout: 1
labels:
ansible.test.1: hello
ansible.test.2: world
@ -394,6 +395,7 @@
name: "{{ cname }}"
state: started
hostname: example.org
stop_timeout: 2
labels:
ansible.test.1: hello
ansible.test.4: ignore

View file

@ -2626,7 +2626,45 @@
## stop_timeout ####################################################
####################################################################
# TODO: - stop_timeout
- name: stop_timeout
docker_container:
image: alpine:3.8
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
stop_timeout: 2
state: started
register: stop_timeout_1
- name: stop_timeout (idempotency)
docker_container:
image: alpine:3.8
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
stop_timeout: 2
state: started
register: stop_timeout_2
- name: stop_timeout (no change)
# stop_timeout changes are ignored by default
docker_container:
image: alpine:3.8
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
stop_timeout: 1
state: started
register: stop_timeout_3
- name: cleanup
docker_container:
name: "{{ cname }}"
state: absent
stop_timeout: 1
- assert:
that:
- stop_timeout_1 is changed
- stop_timeout_2 is not changed
- stop_timeout_3 is not changed
####################################################################
## sysctls #########################################################