@db_api.retry_if_session_inactive()
def add_provisioning_component(context, object_id, object_type, entity):
 log_dict = {'entity': entity, 'oid': object_id, 'otype': object_type}
 standard_attr_id = _get_standard_attr_id(context, object_id, object_type)
 if (not standard_attr_id):
  return
 record = context.session.query(pb_model.ProvisioningBlock).filter_by(standard_attr_id=standard_attr_id, entity=entity).first()
 if record:
  LOG.debug('Ignored duplicate provisioning block setup for %(otype)s %(oid)s by entity %(entity)s.', log_dict)
  return
 with context.session.begin(subtransactions=True):
  record = pb_model.ProvisioningBlock(standard_attr_id=standard_attr_id, entity=entity)
  context.session.add(record)
 LOG.debug('Transition to ACTIVE for %(otype)s object %(oid)s will not be triggered until provisioned by entity %(entity)s.', log_dict)

@ db_api . retry_if_session_inactive ( ) def add_provisioning_component ( context , object_id , object_type , entity ) : log_dict = { 'entity' : entity , 'oid' : object_id , 'otype' : object_type } standard_attr_id = _get_standard_attr_id ( context , object_id , object_type ) if ( not standard_attr_id ) : return record = context . session . query ( pb_model . ProvisioningBlock ) . filter_by ( standard_attr_id = standard_attr_id , entity = entity ) . first ( ) if record : LOG . debug ( 'Ignored duplicate provisioning block setup for %(otype)s %(oid)s by entity %(entity)s.' , log_dict ) return with context . session . begin ( subtransactions = True ) : record = pb_model . ProvisioningBlock ( standard_attr_id = standard_attr_id , entity = entity ) context . session . add ( record ) LOG . debug ( 'Transition to ACTIVE for %(otype)s object %(oid)s will not be triggered until provisioned by entity %(entity)s.' , log_dict )
adds a provisioning block by an entity to a given object .