Browse Source

podman/create: make containers_to_check more realistic

containers_to_check is a list of containers that run something and then
exit with a return code. Later we will check what their return code is
and make sure the containers didn't fail before we continue with the
deployment.

Also, if a container failed to be created or updated; we don't want to include
it in the list that contains the containers in which we want to check if
the returned RC is valid; since we already know the container didn't
terminate correctly.

Closes-Bug: #1878405
Change-Id: Ia3a985d923c5f44babaae601f3ba62b6d48659da
tags/1.4.0
Emilien Macchi 1 month ago
parent
commit
d160d8c4b0
1 changed files with 17 additions and 4 deletions
  1. +17
    -4
      tripleo_ansible/roles/tripleo_container_manage/tasks/podman/create.yml

+ 17
- 4
tripleo_ansible/roles/tripleo_container_manage/tasks/podman/create.yml View File

@@ -97,11 +97,24 @@
when:
- not ansible_check_mode|bool

- name: "Create facts for containers which changed or failed or which require rc check"
- name: "Create fact for containers which changed"
set_fact:
containers_changed: "{{ create_async_poll_results.results | get_changed_containers }}"
containers_failed: "{{ create_async_poll_results.results | get_failed_containers }}"
containers_to_check: "{{ batched_container_data | haskey(attribute='command', excluded_keys=['action', 'restart']) | list_of_keys | default([]) }}"
# List of containers which have changed (created or updated)
containers_changed: "{{ create_async_poll_results.results | get_changed_containers | default([]) }}"

- name: "Create fact for containers which failed"
set_fact:
# List of containers which returned an error when creating or updating them
containers_failed: "{{ create_async_poll_results.results | get_failed_containers | default([]) }}"

- name: "Create fact for containers which require rc check"
set_fact:
# List of containers which would terminate with a return code that needs to be valid.
# We assume that container configs that don't have a restart policy nor action
# (used for podman exec) will run something and then exit with a return code.
containers_to_check: >-
{{ batched_container_data | haskey(attribute='image', excluded_keys=['action', 'restart']) |
list_of_keys | default([]) | difference(containers_failed) }}

- name: Print the containers that failed to start
fail:


Loading…
Cancel
Save