tripleo-container-manage: fix exec check
Fix the task which check if the container where the exec happens is actually running. Also podman_containers needs to be refreshed at every start_order to get new container informations status. So moving podman_containers from main, and putting it where we need it: - before processing the list of containers to delete - when start_order playbook starts Co-Authored-By: Sagi Shnaidman <sshnaidm@redhat.com> Change-Id: I2afb71288208c8b97763caa832c94e06e1b9457c
This commit is contained in:
parent
7756586d6a
commit
e68d4b42a2
|
@ -14,6 +14,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
- name: Gather podman infos
|
||||
podman_container_info: {}
|
||||
register: podman_containers
|
||||
when:
|
||||
- tripleo_container_manage_cli == 'podman'
|
||||
|
||||
- name: "Delete containers managed by Podman for {{ tripleo_container_manage_config }}"
|
||||
when:
|
||||
- tripleo_container_manage_cli == 'podman'
|
||||
|
|
|
@ -32,12 +32,6 @@
|
|||
tags:
|
||||
- always
|
||||
|
||||
- name: Gather podman infos
|
||||
podman_container_info: {}
|
||||
register: podman_containers
|
||||
when:
|
||||
- tripleo_container_manage_cli == 'podman'
|
||||
|
||||
- name: Create container logs path
|
||||
file:
|
||||
path: "{{ tripleo_container_manage_log_path }}"
|
||||
|
|
|
@ -19,11 +19,16 @@
|
|||
block:
|
||||
- name: "Check if {{ container_data.command.0 }} container is running"
|
||||
block:
|
||||
- name: Get container status
|
||||
set_fact:
|
||||
container_running: >-
|
||||
{{ podman_containers.containers | selectattr('Name', 'equalto', container_data.command.0 ) |
|
||||
map(attribute='State.Running') | first | default(false) }}
|
||||
- name: "Fail if {{ container_data.command.0 }} is not running"
|
||||
fail:
|
||||
msg: "Can't run container exec for {{ container_name }}, {{ container_data.command.0 }} is not running"
|
||||
when:
|
||||
- not podman_containers.containers.0.State.Running
|
||||
- not container_running|bool
|
||||
- name: "Prepare the exec command for {{ container_name }}"
|
||||
set_fact:
|
||||
cmd_template:
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
- name: Gather podman infos
|
||||
podman_container_info: {}
|
||||
register: podman_containers
|
||||
when:
|
||||
- tripleo_container_manage_cli == 'podman'
|
||||
|
||||
- name: "Batching items for start_order {{ order }}"
|
||||
include_tasks: podman/create.yml
|
||||
loop: "{{ data | batch(tripleo_container_manage_concurrency) | list }}"
|
||||
|
|
Loading…
Reference in New Issue