mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 15:11:23 -07:00
Provide a way to explicitly invoke the debugger (#34006)
* Provide a way to explicitly invoke the debugger with in the debug strategy * Merge the debugger strategy into StrategyBase * Fix some logic, pin to a single result * Make redo also continue * Make sure that if the debug closure doesn't need to process the result, that we still return it * Fix failing tests for the strategy * Clean up messages from debugger and exit code to match bin/ansible * Move the FieldAttribute higher, to apply at different levels * make debugger a string, expand logic * Better host state rollbacks * More explicit debugger prompt * ENABLE_TASK_DEBUGGER should be boolean, and better docs * No bare except, add pprint, alias h, vars to task_vars * _validate_debugger can ignore non-string, that can be caught later * Address issue if there were no previous tasks/state, and use the correct key * Update docs for changes to the debugger * Guard against a stat going negative through use of decrement * Add a few notes about using the debugger on the free strategy * Add changelog entry for task debugger * Add a few versionadded indicators and a note about vars -> task_vars
This commit is contained in:
parent
e802b769e6
commit
d1846425db
9 changed files with 394 additions and 176 deletions
|
@ -64,6 +64,26 @@ class TaskResult:
|
|||
def is_unreachable(self):
|
||||
return self._check_key('unreachable')
|
||||
|
||||
def needs_debugger(self, globally_enabled=False):
|
||||
_debugger = self._task_fields.get('debugger')
|
||||
|
||||
ret = False
|
||||
if globally_enabled and (self.is_failed() 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():
|
||||
ret = True
|
||||
elif _debugger in ('on_unreachable',) and self.is_unreachable():
|
||||
ret = True
|
||||
elif _debugger in('on_skipped',) and self.is_skipped():
|
||||
ret = True
|
||||
|
||||
return ret
|
||||
|
||||
def _check_key(self, key):
|
||||
'''get a specific key from the result or its items'''
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue