summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2016-11-16 02:01:30 -0600
committerJames Cammarata <jimi@sngx.net>2016-11-18 11:09:36 -0600
commit0871d955feca14fe36519d6a51eac8f0ac85bf90 (patch)
tree0bbe89503c2035cfd5f139c2b98fcd6ca0022e4a /test
parent159399fea4cef14f67f60c1981da123ab06b6b49 (diff)
downloadansible-0871d955feca14fe36519d6a51eac8f0ac85bf90.tar.gz
Reworking iterator logic regarding failed states during always
Previous changes addressed a corner case, which unfortunately introduced another bug. This patch adds a new flag to the host state (did_rescue) which is set to true when the rescue portion of a block completes. This flag is then checked in _check_failed_state() when the fail_state != FAILED_NONE. This lead to the discovery of another bug - current strategies are not advancing hosts to ITERATING_COMPLETE after doing a peek at the next task, leaving the host state in the run_state of the final task. To address this, before gathering the list of failed hosts in StrategyBase.run(), a final pass through the iterator for all hosts is done to ensure each host is in its final state. This way, no strategy derived from StrategyBase has to worry about it and it's handled. Fixes #17983 (cherry picked from commit ca5b361ad869103282faf6f67125a9316fdf9f79)
Diffstat (limited to 'test')
-rw-r--r--test/units/plugins/strategies/test_strategy_base.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/units/plugins/strategies/test_strategy_base.py b/test/units/plugins/strategies/test_strategy_base.py
index faa6173eb4..8a8789aa72 100644
--- a/test/units/plugins/strategies/test_strategy_base.py
+++ b/test/units/plugins/strategies/test_strategy_base.py
@@ -331,8 +331,8 @@ class TestStrategyBase(unittest.TestCase):
self.assertEqual(results[0], task_result)
self.assertEqual(strategy_base._pending_results, 0)
self.assertNotIn('test01', strategy_base._blocked_hosts)
- self.assertIn('test01', mock_tqm._failed_hosts)
- del mock_tqm._failed_hosts['test01']
+ #self.assertIn('test01', mock_tqm._failed_hosts)
+ #del mock_tqm._failed_hosts['test01']
mock_iterator.is_failed.return_value = False
task_result = TaskResult(host=mock_host.name, task=mock_task._uuid, return_data='{"unreachable": true}')