[stable-only] Add writer DB context to "add_provisioning_component"

To ensure the "standardatributes" register is present during the
creation of the "provisioningblocks" register, the method
"add_provisioning_component" is wrapped with a database writer
context. That will ensure the standard attribute ID, used as a
foreign key in the "provisioningblocks" table, is present during
the transaction.

Closes-Bug: #1991222
Change-Id: If57d822ff617c2f9b5e5cade7d4ca74065376e55
(cherry picked from commit 9db730764c)
This commit is contained in:
Rodolfo Alonso Hernandez 2022-09-28 23:32:20 +02:00
parent d847b52c4f
commit 99bce9d055
1 changed files with 1 additions and 0 deletions

View File

@ -41,6 +41,7 @@ def add_model_for_resource(resource, model):
@db_api.retry_if_session_inactive()
@db_api.CONTEXT_WRITER
def add_provisioning_component(context, object_id, object_type, entity):
"""Adds a provisioning block by an entity to a given object.