To reproduce this bug in dev environment is required to perform the following curl request (don't forget to put the correct token):
curl 'http://127.0.0.1:8000/api/nodegroups/' -X POST -H 'Accept: application/json' -H 'Cookie: i18next=en-US; token=token1441899446' --data '{"cluster_id":100,"name":"cluster"}'
Please see traceback:
{
"message": "Traceback (most recent call last):\n File \"/usr/lib/python2.6/site-packages/nailgun/api/v1/handlers/base.py\", line 166, in checked_data\n valid_data = method(data, **kwargs)\n File \"/usr/lib/python2.6/site-packages/nailgun/api/v1/validators/node_group.py\", line 32, in validate\n if cluster.net_provider == consts.CLUSTER_NET_PROVIDERS.nova_network:\nAttributeError: 'NoneType' object has no attribute 'net_provider'\n",
"errors": []
}
Internal server error happens when an incorrect 'cluster_id' value is passed in the request body. In our case the incorrect cluster id is 100.
I suppose that NodeGroupValidator must be strengthened by checking on absence of a cluster. Also must be provided some error message which will inform about that.
Link to the block of code: https://github.com/stackforge/fuel-web/blob/master/nailgun/nailgun/api/v1/validators/node_group.py#L31-L35
Please add steps to reproduce.