docker_container idempotency: work around Docker not returning true configured command when command is [] (#1085)

* Work around Docker not returning true configured command when command is [].

* Lint.

* Add test.

* Add changelog fragment.
This commit is contained in:
Felix Fontein
2025-06-08 19:05:09 +02:00
committed by GitHub
parent 8ecbd9a5cc
commit e9f4553b01
3 changed files with 47 additions and 1 deletions
@@ -385,6 +385,16 @@
force_kill: true
register: command_5
- name: command (correct, empty list, idempotency)
docker_container:
image: "{{ docker_test_image_alpine }}"
command_handling: correct
command: []
name: "{{ cname }}"
state: present # the container will use the default command and likely has been exited by this point, so don't use 'state: started' here
force_kill: true
register: command_6
- name: cleanup
docker_container:
name: "{{ cname }}"
@@ -399,6 +409,7 @@
- command_3 is not changed
- command_4 is changed
- command_5 is changed
- command_6 is not changed
####################################################################
## cpu_period ######################################################