diff options
| author | Mark Goddard <mark@stackhpc.com> | 2019-11-14 12:12:07 +0000 |
|---|---|---|
| committer | Mark Goddard <mark@stackhpc.com> | 2019-11-14 15:08:09 +0000 |
| commit | 64d07c0b7fedf96c489772f7e6619fe112e4189a (patch) | |
| tree | a586a2d1280660b44fd1bb332705fe1bd41b0813 /ansible/library | |
| parent | 8a003189ef52e0cbd510d6fc2e28a8742283448a (diff) | |
| download | kolla-ansible-64d07c0b7fedf96c489772f7e6619fe112e4189a.tar.gz kolla-ansible-64d07c0b7fedf96c489772f7e6619fe112e4189a.zip | |
Attempt to pull image before stopping and removing container
* Deploy services using kolla-ansible deploy
* Reconfigure the image for one or more services to use an invalid
* config
* Deploy/reconfigure services using kolla-ansible reconfigure
The invalid config could be a wrong docker registry, wrong image name,
wrong tag, etc.
The restart handler for the service fails, and the old container is
left running.
The restart handler for the service fails, and the old container is
stopped and removed. This leaves the service in a broken state.
This change fixes the issue by pulling the image if necessary prior to
stopping and removing the container.
Change-Id: I85b2a1b224d4c4d85c32c4922a2cd2c41171a1dc
Closes-Bug: #1852572
Diffstat (limited to 'ansible/library')
| -rw-r--r-- | ansible/library/kolla_docker.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ansible/library/kolla_docker.py b/ansible/library/kolla_docker.py index b9b1e724c..249a3477f 100644 --- a/ansible/library/kolla_docker.py +++ b/ansible/library/kolla_docker.py @@ -742,6 +742,11 @@ class DockerWorker(object): # If config_strategy is COPY_ONCE or container's parameters are # changed, try to start a new one. if config_strategy == 'COPY_ONCE' or self.check_container_differs(): + # NOTE(mgoddard): Pull the image if necessary before stopping the + # container, otherwise a failure to pull the image will leave the + # container stopped. + if not self.check_image(): + self.pull_image() self.stop_container() self.remove_container() self.start_container() |
