def _create_association(context, namespace_name, resource_type_name, values, session):
 namespace_resource_type_rec = models.MetadefNamespaceResourceType()
 metadef_utils.drop_protected_attrs(models.MetadefNamespaceResourceType, values)
 namespace_resource_type_rec.update(values.copy())
 try:
  namespace_resource_type_rec.save(session=session)
 except db_exc.DBDuplicateEntry:
  LOG.debug('The metadata definition resource-type association of resource_type=%(resource_type_name)s to namespace=%(namespace_name)s, already exists.', {'resource_type_name': resource_type_name, 'namespace_name': namespace_name})
  raise exc.MetadefDuplicateResourceTypeAssociation(resource_type_name=resource_type_name, namespace_name=namespace_name)
 return namespace_resource_type_rec.to_dict()

def _create_association ( context , namespace_name , resource_type_name , values , session ) : namespace_resource_type_rec = models . MetadefNamespaceResourceType ( ) metadef_utils . drop_protected_attrs ( models . MetadefNamespaceResourceType , values ) namespace_resource_type_rec . update ( values . copy ( ) ) try : namespace_resource_type_rec . save ( session = session ) except db_exc . DBDuplicateEntry : LOG . debug ( 'The metadata definition resource-type association of resource_type=%(resource_type_name)s to namespace=%(namespace_name)s, already exists.' , { 'resource_type_name' : resource_type_name , 'namespace_name' : namespace_name } ) raise exc . MetadefDuplicateResourceTypeAssociation ( resource_type_name = resource_type_name , namespace_name = namespace_name ) return namespace_resource_type_rec . to_dict ( )
create an association .