-
Notifications
You must be signed in to change notification settings - Fork 24.2k
clear_host_errors - fix handling unreachable errors #78075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
|
As a note I looked at fixing 31543 in the past and had this in diff --git a/lib/ansible/plugins/strategy/linear.py b/lib/ansible/plugins/strategy/linear.py
index d90d347d3e3..01c2bbfeb01 100644
--- a/lib/ansible/plugins/strategy/linear.py
+++ b/lib/ansible/plugins/strategy/linear.py
@@ -411,23 +411,20 @@ class StrategyModule(StrategyBase):
for res in results:
# execute_meta() does not set 'failed' in the TaskResult
# so we skip checking it with the meta tasks and look just at the iterator
- if (res.is_failed() or res._task.action in C._ACTION_META) and iterator.is_failed(res._host):
+ #if (res.is_failed() or res._task.action in C._ACTION_META) and iterator.is_failed(res._host):
+ if res.is_failed():
failed_hosts.append(res._host.name)
elif res.is_unreachable():
unreachable_hosts.append(res._host.name)
# if any_errors_fatal and we had an error, mark all hosts as failed
if any_errors_fatal and (len(failed_hosts) > 0 or len(unreachable_hosts) > 0):
- dont_fail_states = frozenset([IteratingStates.RESCUE, IteratingStates.ALWAYS])
+ # would probably need a new flag to abort the play (and for PlayIterator to revert the flag when rescue)
+ iterator.end_play = True
+ # FIXME self._tqm.RUN_FAILED_BREAK_PLAY
for host in hosts_left:
- (s, _) = iterator.get_next_task_for_host(host, peek=True)
- # the state may actually be in a child state, use the get_active_state()
- # method in the iterator to figure out the true active state
- s = iterator.get_active_state(s)
- if s.run_state not in dont_fail_states or \
- s.run_state == IteratingStates.RESCUE and s.fail_state & FailedStates.RESCUE != 0:
- self._tqm._failed_hosts[host.name] = True
- result |= self._tqm.RUN_FAILED_BREAK_PLAY
+ if host.name not in failed_hosts:
+ #self._tqm._failed_hosts[host.name] = True
+ iterator.mark_host_failed(host)
display.debug("done checking for any_errors_fatal")
display.debug("checking for max_fail_percentage")Basically the idea was to utilize It would also fix #73246 it seems. I feel like there are too many fixes in the current (devel) implemetation ( There is probably a reason why this wasn't done like this when it was originally written though? 🧐 Anyway just thought I'd share this in case you wanted to experiment with that idea as well. |
3bee862 to
d2c8520
Compare
d2c8520 to
2b0e9fb
Compare
a746289 to
872d5a1
Compare
This comment was marked as outdated.
This comment was marked as outdated.
872d5a1 to
16d95ad
Compare
f1c97eb to
cedc6fe
Compare
cedc6fe to
02728dd
Compare
…bsequent play capture nuance in the documentation ci_complete
02728dd to
9a7a78b
Compare
test/integration/targets/meta_tasks/test_clear_host_errors/unreachable_host.yml
Outdated
Show resolved
Hide resolved
test/integration/targets/meta_tasks/test_clear_host_errors/unreachable_host.yml
Outdated
Show resolved
Hide resolved
971ae7d to
04f5877
Compare
04f5877 to
8317893
Compare
8317893 to
fbf0563
Compare
I suppose another option would be to document the current behavior and add a new meta task |
|
Do you think the current behavior of On a tangential note, I'm questioning how useful |
SUMMARY
Fixes #35086
Fixes #86208
On devel, unreachable hosts pick up where they left off.
On this branch, unreachable hosts pick up at the next play.
I'm not sure if this is the right behavior, because
I can imagine content relying on the behavior of devel (it's the only mechanism to recover an unreachable host, and it could be intuitive using the free strategy), andpeople using the linear strategy could expect the host should start at the task following the next applicable task following the clear_host_errors task instead of the next play.I'd also be open to just documenting the current behavior or making it configurable.
ISSUE TYPE