tripleo_container_manage: fail if podman_container returns stderr
If podman_container returns non-empty stderr, but the tasks didn't report failure when running in async, we want to fail because the container is in error and we need to catch it. Change-Id: I2ffba02ce1a2ec7bcca6ff152a53f9fe34e3e624
This commit is contained in:
parent
9f27089134
commit
3880fc7690
|
@ -406,9 +406,10 @@ class FilterModule(object):
|
|||
"""
|
||||
failed = []
|
||||
for item in async_results:
|
||||
async_result_item = item['create_async_result_item']
|
||||
try:
|
||||
if item['failed'] or not item['finished']:
|
||||
async_result_item = item['create_async_result_item']
|
||||
if (item['failed'] or not item['finished']
|
||||
or async_result_item['stderr'] != ''):
|
||||
for k, v in async_result_item['container_data'].items():
|
||||
failed.append(k)
|
||||
except KeyError:
|
||||
|
|
|
@ -839,6 +839,23 @@ class TestHelperFilters(tests_base.TestCase):
|
|||
"results_file": "/root/.ansible_async/948704694230.17597",
|
||||
"started": 1
|
||||
},
|
||||
{
|
||||
"ansible_job_id": "9487088344230.17597",
|
||||
"ansible_loop_var": "container_data",
|
||||
"changed": True,
|
||||
"create_async_result_item": {
|
||||
"stderr": "not happy",
|
||||
"container_data": {
|
||||
"haproxy_failed": {
|
||||
"image": "haproxy:latest",
|
||||
}
|
||||
}
|
||||
},
|
||||
"failed": False,
|
||||
"finished": 1,
|
||||
"results_file": "/root/.ansible_async/948704694230.17597",
|
||||
"started": 1
|
||||
},
|
||||
{
|
||||
"ansible_job_id": "948704694230.17597",
|
||||
"ansible_loop_var": "container_data",
|
||||
|
@ -881,7 +898,7 @@ class TestHelperFilters(tests_base.TestCase):
|
|||
"started": 1
|
||||
}
|
||||
]
|
||||
expected_list = ['memcached', 'mysql']
|
||||
expected_list = ['haproxy_failed', 'memcached', 'mysql']
|
||||
result = self.filters.get_failed_containers(data)
|
||||
self.assertEqual(result, expected_list)
|
||||
|
||||
|
|
Loading…
Reference in New Issue