def make_security_group_list(context, group_ids): if not group_ids or not utils.attr_specified(group_ids): return ([], []) group_ids = list(set(group_ids)) groups = [] for gid in group_ids: group = db_api.security_group_find(context, id=gid, scope=db_api.ONE) if not group: raise sg_ext.SecurityGroupNotFound(id=gid) groups.append(group) return (group_ids, groups)