Skip to content

Commit

Permalink
Don't wait for removal during check mode. (#66145)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Jan 2, 2020
1 parent 19f77fa commit 14e32c8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ansible/modules/cloud/docker/docker_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -2657,7 +2657,7 @@ def present(self, state):
if not self.parameters.image:
self.fail('Cannot create container when image is not specified!')
self.diff_tracker.add('exists', parameter=True, active=False)
if container.removing:
if container.removing and not self.check_mode:
# Wait for container to be removed before trying to create it
self.wait_for_state(container.Id, wait_states=['removing'], accept_removal=True)
new_container = self.container_create(self.parameters.image, self.parameters.create_parameters)
Expand Down Expand Up @@ -2685,7 +2685,8 @@ def present(self, state):
if container.running:
self.container_stop(container.Id)
self.container_remove(container.Id)
self.wait_for_state(container.Id, wait_states=['removing'], accept_removal=True)
if not self.check_mode:
self.wait_for_state(container.Id, wait_states=['removing'], accept_removal=True)
new_container = self.container_create(image_to_use, self.parameters.create_parameters)
if new_container:
container = new_container
Expand Down

0 comments on commit 14e32c8

Please sign in to comment.