mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
Honor ignore_errors when invoking the debugger, add config to disable this behavior (#39868)
* Honor ignore_errors when invoking the debugger, add config to disable this behavior. Fixes #39863 * Limit ignore_errors logic to failed
This commit is contained in:
parent
e7afd3d378
commit
079318bf4a
2 changed files with 16 additions and 2 deletions
|
@ -7,6 +7,7 @@ __metaclass__ = type
|
|||
|
||||
from copy import deepcopy
|
||||
|
||||
from ansible import constants as C
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
from ansible.vars.clean import strip_internal_keys
|
||||
|
||||
|
@ -66,16 +67,17 @@ class TaskResult:
|
|||
|
||||
def needs_debugger(self, globally_enabled=False):
|
||||
_debugger = self._task_fields.get('debugger')
|
||||
_ignore_errors = C.TASK_DEBUGGER_IGNORE_ERRORS and self._task_fields.get('ignore_errors')
|
||||
|
||||
ret = False
|
||||
if globally_enabled and (self.is_failed() or self.is_unreachable()):
|
||||
if globally_enabled and ((self.is_failed() and not _ignore_errors) or self.is_unreachable()):
|
||||
ret = True
|
||||
|
||||
if _debugger in ('always',):
|
||||
ret = True
|
||||
elif _debugger in ('never',):
|
||||
ret = False
|
||||
elif _debugger in ('on_failed',) and self.is_failed():
|
||||
elif _debugger in ('on_failed',) and self.is_failed() and not _ignore_errors:
|
||||
ret = True
|
||||
elif _debugger in ('on_unreachable',) and self.is_unreachable():
|
||||
ret = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue