[nailgun] Nailgun returns Internal Server Error 500 while trying to download default facts info for unassigned nodes

Bug #1574718 reported by Vitalii Kulanov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Committed
Medium
Vitalii Kulanov

Bug Description

Detailed bug description:
If we try to get default facts (provisioning/deployment) info (through the REST API) for the nodes that do not belong to any cluster nailgun returns "500 Server Error: Internal Server Error"

[root@fuel ~]# fuel --env 1 provisioning --default --node 1,2,5
500 Server Error: Internal Server Error for url: http://10.20.0.2:8000/api/v1/clusters/1/orchestrator/provisioning/defaults/?nodes=1,2,5 ('NoneType' object has no attribute 'attributes')

Nailgun log file results (/var/log/nailgun/app.log):
http://paste.openstack.org/show/495336/

[root@fuel ~]# fuel --env 1 deployment --default --node 1,2,5
500 Server Error: Internal Server Error for url: http://10.20.0.2:8000/api/v1/clusters/1/orchestrator/deployment/defaults/?nodes=1,2,5 (5)

Nailgun log file results (/var/log/nailgun/app.log):
http://paste.openstack.org/show/495337/

Steps to reproduce:
1. Deploy Fuel (e.g. 1 master + 5 nodes).
2. Create new env, but do not add some nodes to it.
3. Try to get fact info through the python-fuelclient, e.g.:
     fuel --env 1 provisioning --default --node 5
4. The result of command execution:
500 Server Error: Internal Server Error for url: http://10.20.0.2:8000/api/v1/clusters/1/orchestrator/provisioning/defaults/?nodes=5 ('NoneType' object has no attribute 'attributes')

Expected results:
More user-friendly response with detailed problem description, e.g.:
[root@fuel ~]# fuel --env 1 provisioning --default --node 1,2,5
400 Client Error: Bad Request for url: http://10.20.0.2:8000/api/v1/clusters/1/orchestrator/provisioning/defaults/?nodes=1,2,5 (Nodes 5 do not belong to any cluster)

Actual result:
[root@fuel ~]# fuel --env 1 provisioning --default --node 5
500 Server Error: Internal Server Error for url: http://10.20.0.2:8000/api/v1/clusters/1/orchestrator/provisioning/defaults/?nodes=5 ('NoneType' object has no attribute 'attributes')

Reproducibility:
Always

Description of the environment:
cat /etc/fuel_build_id:
 61
cat /etc/fuel_build_number:
 61
cat /etc/fuel_release:
 10.0
cat /etc/fuel_openstack_version:
 newton-10.0

Additional information:
The problem is that if we didn't assign some nodes to any environment they don't contain any information about cluster, so while trying to get access to nodes' cluster attributes (e.g. https://github.com/openstack/fuel-web/blob/881588dcc06dfe1dec59570c2d6eda1a9d5afa3b/nailgun/nailgun/objects/node.py#L1188) exception is raised.

Changed in fuel:
assignee: nobody → Vitalii Kulanov (vitaliy-t)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-web (master)

Fix proposed to branch: master
Review: https://review.openstack.org/310021

Changed in fuel:
status: New → In Progress
Artem Roma (aroma-x)
Changed in fuel:
importance: Undecided → Medium
milestone: none → 10.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-web (master)

Reviewed: https://review.openstack.org/310021
Committed: https://git.openstack.org/cgit/openstack/fuel-web/commit/?id=ba3f370c040295d23cbad8e1b622e79b22dde93f
Submitter: Jenkins
Branch: master

commit ba3f370c040295d23cbad8e1b622e79b22dde93f
Author: tivaliy <email address hidden>
Date: Mon Apr 25 19:05:42 2016 +0300

    Add nodes placement validation for default facts request

    Fix Nailgun responce when trying to download
    default facts info (provisioning/deployment) for nodes
    that do not belong to any clusters or different clusters, e.g.

    GET clusters/1/orchestrator/provisioning/defaults/?nodes=2,3

    Change-Id: I9e9dedbcabdbf83ebf71b940226ad48692c1c518
    Closes-Bug: 1574718

Changed in fuel:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.