mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Avoid default serialization of classes in dump_attrs
For playbook base objects, when dumping attributes via dump_attrs() an attribute like loop_control is a class. Using the default serialization for these is slow and consumes a lot of memory. Since LoopControl is also based on the Base class, we can use serialize() instead and save a lot of resources. This also adds a from_attrs() complimentary method to nicely turn the dumped attrs back into proper field attributes. Fixes #23579
This commit is contained in:
@@ -332,8 +332,7 @@ class StrategyBase:
|
||||
found_task = iterator.get_original_task(original_host, task_result._task)
|
||||
original_task = found_task.copy(exclude_parent=True, exclude_tasks=True)
|
||||
original_task._parent = found_task._parent
|
||||
for (attr, val) in iteritems(task_result._task_fields):
|
||||
setattr(original_task, attr, val)
|
||||
original_task.from_attrs(task_result._task_fields)
|
||||
|
||||
task_result._host = original_host
|
||||
task_result._task = original_task
|
||||
|
||||
Reference in New Issue
Block a user