@classmethod
    def _validate_unique_name(cls, data, *filters):
        nodegroup_query = objects.NodeGroupCollection.filter_by(
            None, name=data['name'], cluster_id=data['cluster_id'])
        if filters:
            nodegroup_query = nodegroup_query.filter(*filters)
        nodegroup_exists = db.query(nodegroup_query.exists()).scalar()
        if nodegroup_exists:
            raise errors.NotAllowed(
                "Node group '{0}' already exists "
                "in environment {1}.".format(
                    data['name'], data['cluster_id']))
Validate node group name to be unique.
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/api/v1/validators/node_group.py/NodeGroupValidator._validate_unique_name