mirror of
https://github.com/ansible/awx.git
synced 2026-10-31 14:36:17 -02:30
[AAP-86051] Document serializer persistence context for bulk bypass dedupe
Point bulk host/job launch create() and workflow bulk audit at DAB validation_bypass_observability guidance for is_valid() + audit_bulk_*. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2274,6 +2274,7 @@ class BulkHostCreateSerializer(serializers.Serializer):
|
|||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
|
# DAB: dedupe Validation rejected (child BulkHostSerializer is_valid) vs ORM bypass bulk_create.
|
||||||
with serializer_mediated_persistence_context():
|
with serializer_mediated_persistence_context():
|
||||||
return self._create_bulk_hosts(validated_data)
|
return self._create_bulk_hosts(validated_data)
|
||||||
|
|
||||||
@@ -5282,6 +5283,7 @@ class BulkJobLaunchSerializer(PromptFieldCleanTextMixin, serializers.Serializer)
|
|||||||
)
|
)
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
|
# DAB: dedupe Validation rejected (is_valid) vs audit_workflow_job_nodes / bulk_create bypass logs.
|
||||||
with serializer_mediated_persistence_context():
|
with serializer_mediated_persistence_context():
|
||||||
return self._create_bulk_job_launch(validated_data)
|
return self._create_bulk_job_launch(validated_data)
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,11 @@ def audit_workflow_job_nodes_for_bulk_create(nodes: Iterable[Model]) -> None:
|
|||||||
columns. Node prompt values (limit, job_tags, etc.) live in ``char_prompts`` via
|
columns. Node prompt values (limit, job_tags, etc.) live in ``char_prompts`` via
|
||||||
``NullablePromptPseudoField`` and must be read with ``getattr`` after deferred
|
``NullablePromptPseudoField`` and must be read with ``getattr`` after deferred
|
||||||
attrs are applied on the in-memory instances.
|
attrs are applied on the in-memory instances.
|
||||||
|
|
||||||
|
When called from a DRF ``create()`` after ``is_valid()``, the caller must run
|
||||||
|
inside DAB ``serializer_mediated_persistence_context`` so duplicate
|
||||||
|
``Validation rejected`` / ``ORM bypass`` lines are not emitted (see DAB
|
||||||
|
``docs/lib/validation_bypass_observability.md``).
|
||||||
"""
|
"""
|
||||||
materialized = list(nodes)
|
materialized = list(nodes)
|
||||||
if not materialized:
|
if not materialized:
|
||||||
|
|||||||
Reference in New Issue
Block a user