Browse Source

Merge "tripleo_container_manage: fail if podman_container returns stderr"

tags/1.4.0
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
8e0bb61135
2 changed files with 21 additions and 3 deletions
  1. +3
    -2
      tripleo_ansible/ansible_plugins/filter/helpers.py
  2. +18
    -1
      tripleo_ansible/tests/plugins/filter/test_helpers.py

+ 3
- 2
tripleo_ansible/ansible_plugins/filter/helpers.py View File

@@ -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:


+ 18
- 1
tripleo_ansible/tests/plugins/filter/test_helpers.py View File

@@ -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…
Cancel
Save