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
This commit is contained in:
parent
bffbba4b4c
commit
d160d8c4b0
|
@ -97,11 +97,24 @@
|
||||||
when:
|
when:
|
||||||
- not ansible_check_mode|bool
|
- 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:
|
set_fact:
|
||||||
containers_changed: "{{ create_async_poll_results.results | get_changed_containers }}"
|
# List of containers which have changed (created or updated)
|
||||||
containers_failed: "{{ create_async_poll_results.results | get_failed_containers }}"
|
containers_changed: "{{ create_async_poll_results.results | get_changed_containers | default([]) }}"
|
||||||
containers_to_check: "{{ batched_container_data | haskey(attribute='command', excluded_keys=['action', 'restart']) | list_of_keys | 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
|
- name: Print the containers that failed to start
|
||||||
fail:
|
fail:
|
||||||
|
|
Loading…
Reference in New Issue