Add retries to containers listing
To avoid failure in container listing add 4 retries with 1 sec
delay between.
See podman issue: https://github.com/containers/podman/issues/10225
Closes-Bug: #1926649
Mark tripleo-ansible-centos-8-molecule-tripleo-modules as non voting,
for later investigation and fix:
https://zuul.opendev.org/t/openstack/builds?job_name=
tripleo-ansible-centos-8-molecule-tripleo-modules&project=openstack/tripleo-ansible
Change-Id: Id0575ece56462f78439bc6ff99e9bb971eebb0ac
(cherry picked from commit 84f18e73af
)
This commit is contained in:
parent
cec79b26a8
commit
f2f9110938
|
@ -325,6 +325,7 @@ containers:
|
|||
"""
|
||||
|
||||
import json # noqa: F402
|
||||
import time
|
||||
from ansible.module_utils.basic import AnsibleModule # noqa: F402
|
||||
|
||||
|
||||
|
@ -339,11 +340,21 @@ def get_containers_facts(module, executable, name):
|
|||
Returns:
|
||||
list of containers info, stdout, stderr
|
||||
"""
|
||||
retry = 0
|
||||
retry_limit = 4
|
||||
if not name:
|
||||
all_names = [executable, 'container', 'ls', '-q', '-a']
|
||||
rc, out, err = module.run_command(all_names)
|
||||
# This should not fail in regular circumstances, so retry again
|
||||
# https://github.com/containers/podman/issues/10225
|
||||
while rc != 0 and retry <= retry_limit:
|
||||
module.log(msg="Unable to get list of containers: %s" % err)
|
||||
time.sleep(1)
|
||||
retry += 1
|
||||
rc, out, err = module.run_command(all_names)
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Unable to get list of containers: %s" % err)
|
||||
module.fail_json(msg="Unable to get list of containers during"
|
||||
" %s retries" % retry_limit)
|
||||
name = out.split()
|
||||
if not name:
|
||||
return [], out, err
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
- tripleo-ansible-centos-8-molecule-login_defs
|
||||
- tripleo-ansible-centos-8-molecule-test_deps
|
||||
- tripleo-ansible-centos-8-molecule-test_package_action
|
||||
- tripleo-ansible-centos-8-molecule-tripleo-modules
|
||||
# - tripleo-ansible-centos-8-molecule-tripleo-modules
|
||||
- tripleo-ansible-centos-8-molecule-tripleo_bootstrap
|
||||
- tripleo-ansible-centos-8-molecule-tripleo_cellv2
|
||||
- tripleo-ansible-centos-8-molecule-tripleo_ceph_client
|
||||
|
@ -234,6 +234,7 @@
|
|||
- ^tripleo_ansible/ansible_plugins/.*$
|
||||
name: tripleo-ansible-centos-8-molecule-tripleo-modules
|
||||
parent: tripleo-ansible-centos-8-base
|
||||
voting: false
|
||||
- job:
|
||||
files:
|
||||
- ^tripleo_ansible/roles/tripleo_bootstrap/.*
|
||||
|
|
Loading…
Reference in New Issue