Remove all old pcmklatest images
An operator may make a mistake when importing images, resulting
in more than one image being present. This may happen, for example,
if an image is imported from one source, then another.
To ensure that all old images are deleted, and to prevent a failure
in the command executing the deletion if there is more than one
result when listing the images, we process the deletion in a loop
per stdout line.
Note:
This patch is not required in more recent branches due to other
changes in the process which have eliminated the possibility of
there being more than one image to delete.
Conflicts:
>------docker/services/pacemaker/notify-rabbitmq.yaml
>------docker/services/pacemaker/rpc-rabbitmq.yaml
Closes: rhbz#1727173
Change-Id: I67e0a321fe2c77e54966cd9b70be56a489dd2007
(cherry picked from commit 818c7bb118
)
This commit is contained in:
parent
476b683568
commit
af4d4d3c29
|
@ -253,14 +253,16 @@ outputs:
|
|||
register: cinder_backup_image_id
|
||||
- block:
|
||||
- name: Get a list of container using Cinder-Backup image
|
||||
shell: "docker ps -a -q -f 'ancestor={{cinder_backup_image_id.stdout}}'"
|
||||
shell: "docker ps -a -q -f 'ancestor={{ item }}'"
|
||||
with_items: "{{ cinder_backup_image_id.stdout_lines }}"
|
||||
register: cinder_backup_containers_to_destroy
|
||||
# It will be recreated with the deploy step.
|
||||
- name: Remove any container using the same Cinder-Backup image
|
||||
shell: "docker rm -fv {{item}}"
|
||||
with_items: "{{ cinder_backup_containers_to_destroy.stdout_lines }}"
|
||||
shell: "docker rm -fv {{ item }}"
|
||||
with_items: "{{ cinder_backup_containers_to_destroy.results | map(attribute='stdout_lines') | list | flatten }}"
|
||||
- name: Remove previous Cinder-Backup images
|
||||
shell: "docker rmi -f {{cinder_backup_image_id.stdout}}"
|
||||
shell: "docker rmi -f {{ item }}"
|
||||
with_items: "{{ cinder_backup_image_id.stdout_lines }}"
|
||||
when:
|
||||
- cinder_backup_image_id.stdout != ''
|
||||
- name: Pull latest Cinder-Backup images
|
||||
|
|
|
@ -218,14 +218,16 @@ outputs:
|
|||
register: cinder_volume_image_id
|
||||
- block:
|
||||
- name: Get a list of container using Cinder-Volume image
|
||||
shell: "docker ps -a -q -f 'ancestor={{cinder_volume_image_id.stdout}}'"
|
||||
shell: "docker ps -a -q -f 'ancestor={{ item }}'"
|
||||
with_items: "{{ cinder_volume_image_id.stdout_lines }}"
|
||||
register: cinder_volume_containers_to_destroy
|
||||
# It will be recreated with the delpoy step.
|
||||
# It will be recreated with the deploy step.
|
||||
- name: Remove any container using the same Cinder-Volume image
|
||||
shell: "docker rm -fv {{item}}"
|
||||
with_items: "{{ cinder_volume_containers_to_destroy.stdout_lines }}"
|
||||
shell: "docker rm -fv {{ item }}"
|
||||
with_items: "{{ cinder_volume_containers_to_destroy.results | map(attribute='stdout_lines') | list | flatten }}"
|
||||
- name: Remove previous Cinder-Volume images
|
||||
shell: "docker rmi -f {{cinder_volume_image_id.stdout}}"
|
||||
shell: "docker rmi -f {{ item }}"
|
||||
with_items: "{{ cinder_volume_image_id.stdout_lines }}"
|
||||
when:
|
||||
- cinder_volume_image_id.stdout != ''
|
||||
- name: Pull latest Cinder-Volume images
|
||||
|
|
|
@ -324,14 +324,16 @@ outputs:
|
|||
register: mariadb_image_id
|
||||
- block:
|
||||
- name: Get a list of container using Mariadb image
|
||||
shell: "docker ps -a -q -f 'ancestor={{mariadb_image_id.stdout}}'"
|
||||
shell: "docker ps -a -q -f 'ancestor={{ item }}'"
|
||||
with_items: "{{ mariadb_image_id.stdout_lines }}"
|
||||
register: mariadb_containers_to_destroy
|
||||
# It will be recreated with the delpoy step.
|
||||
# It will be recreated with the deploy step.
|
||||
- name: Remove any container using the same Mariadb image
|
||||
shell: "docker rm -fv {{item}}"
|
||||
with_items: "{{ mariadb_containers_to_destroy.stdout_lines }}"
|
||||
shell: "docker rm -fv {{ item }}"
|
||||
with_items: "{{ mariadb_containers_to_destroy.results | map(attribute='stdout_lines') | list | flatten }}"
|
||||
- name: Remove previous Mariadb images
|
||||
shell: "docker rmi -f {{mariadb_image_id.stdout}}"
|
||||
shell: "docker rmi -f {{ item }}"
|
||||
with_items: "{{ mariadb_image_id.stdout_lines }}"
|
||||
when:
|
||||
- mariadb_image_id.stdout != ''
|
||||
- name: Pull latest Mariadb images
|
||||
|
|
|
@ -304,14 +304,16 @@ outputs:
|
|||
register: redis_image_id
|
||||
- block:
|
||||
- name: Get a list of container using Redis image
|
||||
shell: "docker ps -a -q -f 'ancestor={{redis_image_id.stdout}}'"
|
||||
shell: "docker ps -a -q -f 'ancestor={{ item }}'"
|
||||
with_items: "{{ redis_image_id.stdout_lines }}"
|
||||
register: redis_containers_to_destroy
|
||||
# It will be recreated with the delpoy step.
|
||||
# It will be recreated with the deploy step.
|
||||
- name: Remove any container using the same Redis image
|
||||
shell: "docker rm -fv {{item}}"
|
||||
with_items: "{{ redis_containers_to_destroy.stdout_lines }}"
|
||||
shell: "docker rm -fv {{ item }}"
|
||||
with_items: "{{ redis_containers_to_destroy.results | map(attribute='stdout_lines') | list | flatten }}"
|
||||
- name: Remove previous Redis images
|
||||
shell: "docker rmi -f {{redis_image_id.stdout}}"
|
||||
shell: "docker rmi -f {{ item }}"
|
||||
with_items: "{{ redis_image_id.stdout_lines }}"
|
||||
when:
|
||||
- redis_image_id.stdout != ''
|
||||
- name: Pull latest Redis images
|
||||
|
|
|
@ -379,14 +379,16 @@ outputs:
|
|||
register: haproxy_image_id
|
||||
- block:
|
||||
- name: Get a list of container using Haproxy image
|
||||
shell: "docker ps -a -q -f 'ancestor={{haproxy_image_id.stdout}}'"
|
||||
shell: "docker ps -a -q -f 'ancestor={{ item }}'"
|
||||
with_items: "{{ haproxy_image_id.stdout_lines }}"
|
||||
register: haproxy_containers_to_destroy
|
||||
# It will be recreated with the delpoy step.
|
||||
# It will be recreated with the deploy step.
|
||||
- name: Remove any container using the same Haproxy image
|
||||
shell: "docker rm -fv {{item}}"
|
||||
with_items: "{{ haproxy_containers_to_destroy.stdout_lines }}"
|
||||
shell: "docker rm -fv {{ item }}"
|
||||
with_items: "{{ haproxy_containers_to_destroy.results | map(attribute='stdout_lines') | list | flatten }}"
|
||||
- name: Remove previous Haproxy images
|
||||
shell: "docker rmi -f {{haproxy_image_id.stdout}}"
|
||||
shell: "docker rmi -f {{ item }}"
|
||||
with_items: "{{ haproxy_image_id.stdout_lines }}"
|
||||
when:
|
||||
- haproxy_image_id.stdout != ''
|
||||
- name: Pull latest Haproxy images
|
||||
|
|
|
@ -232,14 +232,16 @@ outputs:
|
|||
register: manila_share_image_id
|
||||
- block:
|
||||
- name: Get a list of container using Manila-Share image
|
||||
shell: "docker ps -a -q -f 'ancestor={{manila_share_image_id.stdout}}'"
|
||||
shell: "docker ps -a -q -f 'ancestor={{ item }}'"
|
||||
with_items: "{{ manila_share_image_id.stdout_lines }}"
|
||||
register: manila_share_containers_to_destroy
|
||||
# It will be recreated with the delpoy step.
|
||||
# It will be recreated with the deploy step.
|
||||
- name: Remove any container using the same Manila-Share image
|
||||
shell: "docker rm -fv {{item}}"
|
||||
with_items: "{{ manila_share_containers_to_destroy.stdout_lines }}"
|
||||
shell: "docker rm -fv {{ item }}"
|
||||
with_items: "{{ manila_share_containers_to_destroy.results | map(attribute='stdout_lines') | list | flatten }}"
|
||||
- name: Remove previous Manila-Share images
|
||||
shell: "docker rmi -f {{manila_share_image_id.stdout}}"
|
||||
shell: "docker rmi -f {{ item }}"
|
||||
with_items: "{{ manila_share_image_id.stdout_lines }}"
|
||||
when:
|
||||
- manila_share_image_id.stdout != ''
|
||||
- name: Pull latest Manila-Share images
|
||||
|
|
|
@ -225,14 +225,16 @@ outputs:
|
|||
register: ovn_dbs_image_id
|
||||
- block:
|
||||
- name: Get a list of container using ovn-dbs image
|
||||
shell: "docker ps -a -q -f 'ancestor={{ovn_dbs_image_id.stdout}}'"
|
||||
shell: "docker ps -a -q -f 'ancestor={{ item }}'"
|
||||
with_items: "{{ ovn_dbs_image_id.stdout_lines }}"
|
||||
register: ovn_dbs_containers_to_destroy
|
||||
# It will be recreated with the deploy step.
|
||||
- name: Remove any container using the same ovn-dbs image
|
||||
shell: "docker rm -fv {{item}}"
|
||||
with_items: "{{ ovn_dbs_containers_to_destroy.stdout_lines }}"
|
||||
shell: "docker rm -fv {{ item }}"
|
||||
with_items: "{{ ovn_dbs_containers_to_destroy.results | map(attribute='stdout_lines') | list | flatten }}"
|
||||
- name: Remove previous ovn-dbs images
|
||||
shell: "docker rmi -f {{ovn_dbs_image_id.stdout}}"
|
||||
shell: "docker rmi -f {{ item }}"
|
||||
with_items: "{{ ovn_dbs_image_id.stdout_lines }}"
|
||||
when:
|
||||
- ovn_dbs_image_id.stdout != ''
|
||||
- name: Pull latest ovn-dbs images
|
||||
|
|
|
@ -276,14 +276,16 @@ outputs:
|
|||
register: rabbitmq_image_id
|
||||
- block:
|
||||
- name: Get a list of container using Rabbitmq image
|
||||
shell: "docker ps -a -q -f 'ancestor={{rabbitmq_image_id.stdout}}'"
|
||||
shell: "docker ps -a -q -f 'ancestor={{ item }}'"
|
||||
with_items: "{{ rabbitmq_image_id.stdout_lines }}"
|
||||
register: rabbitmq_containers_to_destroy
|
||||
# It will be recreated with the delpoy step.
|
||||
# It will be recreated with the deploy step.
|
||||
- name: Remove any container using the same Rabbitmq image
|
||||
shell: "docker rm -fv {{item}}"
|
||||
with_items: "{{ rabbitmq_containers_to_destroy.stdout_lines }}"
|
||||
shell: "docker rm -fv {{ item }}"
|
||||
with_items: "{{ rabbitmq_containers_to_destroy.results | map(attribute='stdout_lines') | list | flatten }}"
|
||||
- name: Remove previous Rabbitmq images
|
||||
shell: "docker rmi -f {{rabbitmq_image_id.stdout}}"
|
||||
shell: "docker rmi -f {{ item }}"
|
||||
with_items: "{{ rabbitmq_image_id.stdout_lines }}"
|
||||
when:
|
||||
- rabbitmq_image_id.stdout != ''
|
||||
- name: Pull latest Rabbitmq images
|
||||
|
|
Loading…
Reference in New Issue