def _security_group_get_by_names(context, session, project_id, group_names):
 query = _security_group_get_query(context, session=session, read_deleted='no', join_rules=False).filter_by(project_id=project_id).filter(models.SecurityGroup.name.in_(group_names))
 sg_models = query.all()
 if (len(sg_models) == len(group_names)):
  return sg_models
 group_names_from_models = [x.name for x in sg_models]
 for group_name in group_names:
  if (group_name not in group_names_from_models):
   raise exception.SecurityGroupNotFoundForProject(project_id=project_id, security_group_id=group_name)

def _security_group_get_by_names ( context , session , project_id , group_names ) : query = _security_group_get_query ( context , session = session , read_deleted = 'no' , join_rules = False ) . filter_by ( project_id = project_id ) . filter ( models . SecurityGroup . name . in_ ( group_names ) ) sg_models = query . all ( ) if ( len ( sg_models ) == len ( group_names ) ) : return sg_models group_names_from_models = [ x . name for x in sg_models ] for group_name in group_names : if ( group_name not in group_names_from_models ) : raise exception . SecurityGroupNotFoundForProject ( project_id = project_id , security_group_id = group_name )
get security group models for a project by a list of names .