[nailgun] Nailgun doesn't check role existence and returns Internal Server Error 500 while trying to get, update, delete non-existing roles in release

Bug #1617229 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:
Nailgun doesn't check role existence and returns Internal Server Error 500 while trying to get, update, delete non-existing roles in release.

Use 'curl' or python-fuelclient
[root@fuel ~]# fuel role --rel 1 --role non-existing --file some.yaml
500 Server Error: Internal Server Error for url: http://10.20.0.2:8000/api/v1/releases/1/roles/non-existing/ (Unexpected exception, please check logs)

Here is nailgun logs:
[root@fuel ~]# tail -n 20 /var/log/nailgun/app.log
.............................................
2016-08-26 09:19:36.584 ERROR [7fb668be6880] (base) Unexpected exception occured
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nailgun/api/v1/handlers/base.py", line 293, in handle_errors
    return func(cls, *args, **kwargs)
  File "<string>", line 2, in GET
  File "/usr/lib/python2.7/site-packages/nailgun/api/v1/handlers/base.py", line 351, in validate
    return func(cls, *args, **kwargs)
  File "<string>", line 2, in GET
  File "/usr/lib/python2.7/site-packages/nailgun/api/v1/handlers/base.py", line 377, in serialize
    resp = func(cls, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/nailgun/api/v1/handlers/role.py", line 53, in GET
    return RoleSerializer.serialize_from_release(release, role_name)
  File "/usr/lib/python2.7/site-packages/nailgun/objects/serializers/role.py", line 25, in serialize_from_release
    meta = release.roles_metadata[role_name]
KeyError: u'non-existing'
................................................

Steps to reproduce:
1. Deploy Fuel (e.g. 1 master + 5 nodes).
2 Try to get, update or delete non-existing role in specific release, .e.g.:
   [root@fuel ~]# fuel role --rel 1 --role non-existing --file some.yaml

Expected results:
Valid responce - 404 no such object found

Actual result:
500 Server Error: Internal Server Error for url: http://10.20.0.2:8000/api/v1/releases/1/roles/non-existing/ (Unexpected exception, please check logs)

Reproducibility:
 Always

Description of the environment:
[root@fuel ~]# shotgun2 short-report
cat /etc/fuel_build_id:
 586
cat /etc/fuel_build_number:
 586
cat /etc/fuel_release:
 10.0
cat /etc/fuel_openstack_version:
 newton-10.0

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/361041

Changed in fuel:
status: New → In Progress
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/361041
Committed: https://git.openstack.org/cgit/openstack/fuel-web/commit/?id=b21840e42275e9a1c9809bfcd2e63a09e9137a45
Submitter: Jenkins
Branch: master

commit b21840e42275e9a1c9809bfcd2e63a09e9137a45
Author: tivaliy <email address hidden>
Date: Fri Aug 26 12:29:33 2016 +0300

    Add check 'role' existence in release

    Now Nailgun doesn't check 'role' existance in release
    that leads to 'Internal Server Error 500' while trying
    to get/update/delete non-existing roles. This patch adds
    check role procedure and returns 404 not found responce
    instead Internal Server Error.

    Change-Id: I9a9e0fc59a86b414dce1fc3b036b90d00db94325
    Closes-Bug: 1617229

Changed in fuel:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-web (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/370047

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/fuel-web 10.0.0rc1

This issue was fixed in the openstack/fuel-web 10.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on fuel-web (stable/mitaka)

Change abandoned by Vitalii Kulanov (<email address hidden>) on branch: stable/mitaka
Review: https://review.openstack.org/370047
Reason: as it was implemented in 9e16710278dd2476030c4f2eb121368e582ae3fd

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/fuel-web 10.0.0

This issue was fixed in the openstack/fuel-web 10.0.0 release.

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.