Non-successful HTTP code responses are handled incorrectly and returns code 500

Bug #1932194 reported by Mitya Eremeev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
masakari
Fix Released
Medium
Mitya Eremeev
Ussuri
Fix Committed
Medium
Unassigned
Victoria
Fix Committed
Medium
Unassigned
Wallaby
Fix Committed
Medium
Unassigned
Xena
Fix Released
Medium
Mitya Eremeev

Bug Description

Tested for master and victoria.

1. Send malformed API request:

$ openstack notification create VM test 2016-01-01T01:00:00.000 '{"test_1": "test_2"}'

Actual behavior:

response:

HttpException: 500: Server Error for url: http://masakari-api.openstack.svc.cluster.local:15868/v1/notifications, The server has either erred or is incapable of performing the requested operation.

service logs:

2021-06-09 10:16:15,745.745 14 ERROR masakari.api.openstack File "/var/lib/openstack/lib/python3.6/site-packages/masakari/exception.py", line 65, in __init__
2021-06-09 10:16:15,745.745 14 ERROR masakari.api.openstack super(ConvertedException, self).__init__()
2021-06-09 10:16:15,745.745 14 ERROR masakari.api.openstack File "/var/lib/openstack/lib/python3.6/site-packages/webob/exc.py", line 268, in __init__
2021-06-09 10:16:15,745.745 14 ERROR masakari.api.openstack **kw)
2021-06-09 10:16:15,745.745 14 ERROR masakari.api.openstack File "/var/lib/openstack/lib/python3.6/site-packages/webob/response.py", line 192, in __init__
2021-06-09 10:16:15,745.745 14 ERROR masakari.api.openstack self.status = status
2021-06-09 10:16:15,745.745 14 ERROR masakari.api.openstack File "/var/lib/openstack/lib/python3.6/site-packages/webob/response.py", line 441, in _status__set
2021-06-09 10:16:15,745.745 14 ERROR masakari.api.openstack raise ValueError('Invalid status code, integer required.')
2021-06-09 10:16:15,745.745 14 ERROR masakari.api.openstack ValueError: Invalid status code, integer required.
2021-06-09 10:16:15,745.745 14 ERROR masakari.api.openstack
2021-06-09 10:16:15,758.758 14 INFO masakari.api.openstack [req-127952a1-9df3-4e3d-ba81-cc1b5826e64b 46a6abcd1a364e88a282eb7f18b61c86 0d72a6bce43241fe9675652491a0e1cf - - -] https://masakari.it.just.works/v1/segments returned with HTTP 500

expected behavior:

API response:

BadRequestException: 400: Client Error for url: http://masakari-api.openstack.svc.cluster.local:15868/v1/notifications, 'instance_uuid' is a required property

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to masakari (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/masakari/+/796732

Changed in masakari:
status: New → In Progress
Mitya Eremeev (mitos)
Changed in masakari:
assignee: nobody → Mitya Eremeev (mitos)
status: In Progress → New
status: New → In Progress
Changed in masakari:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to masakari (master)

Reviewed: https://review.opendev.org/c/openstack/masakari/+/796732
Committed: https://opendev.org/openstack/masakari/commit/5c6fd44504e47ddbec3e0c29d454daeda87f86a4
Submitter: "Zuul (22348)"
Branch: master

commit 5c6fd44504e47ddbec3e0c29d454daeda87f86a4
Author: Mitya_Eremeev <email address hidden>
Date: Fri Jul 9 11:37:37 2021 +0300

    Fix Masakari API to properly return error codes

    Change-Id: I538b9b143c868d9419709356daf0ffc48e2f0df9
    Closes-Bug: #1932194

Changed in masakari:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to masakari (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/masakari/+/803689

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to masakari (stable/victoria)

Fix proposed to branch: stable/victoria
Review: https://review.opendev.org/c/openstack/masakari/+/803830

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to masakari (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/c/openstack/masakari/+/803831

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to masakari (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/masakari/+/803689
Committed: https://opendev.org/openstack/masakari/commit/e3cbcd25b9a31286901ec3159ecc85637183023c
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit e3cbcd25b9a31286901ec3159ecc85637183023c
Author: Mitya_Eremeev <email address hidden>
Date: Fri Jul 9 11:37:37 2021 +0300

    Fix Masakari API to properly return error codes

    Change-Id: I538b9b143c868d9419709356daf0ffc48e2f0df9
    Closes-Bug: #1932194
    (cherry picked from commit 5c6fd44504e47ddbec3e0c29d454daeda87f86a4)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to masakari (stable/victoria)

Reviewed: https://review.opendev.org/c/openstack/masakari/+/803830
Committed: https://opendev.org/openstack/masakari/commit/9a11cd3d6342d576b9221a1e4f49abdf05ae77a8
Submitter: "Zuul (22348)"
Branch: stable/victoria

commit 9a11cd3d6342d576b9221a1e4f49abdf05ae77a8
Author: Mitya_Eremeev <email address hidden>
Date: Fri Jul 9 11:37:37 2021 +0300

    Fix Masakari API to properly return error codes

    Change-Id: I538b9b143c868d9419709356daf0ffc48e2f0df9
    Closes-Bug: #1932194
    (cherry picked from commit 5c6fd44504e47ddbec3e0c29d454daeda87f86a4)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to masakari (stable/ussuri)

Reviewed: https://review.opendev.org/c/openstack/masakari/+/803831
Committed: https://opendev.org/openstack/masakari/commit/b965f3a253e7eca08ac765be90b7c1ae3d86369f
Submitter: "Zuul (22348)"
Branch: stable/ussuri

commit b965f3a253e7eca08ac765be90b7c1ae3d86369f
Author: Mitya_Eremeev <email address hidden>
Date: Fri Jul 9 11:37:37 2021 +0300

    Fix Masakari API to properly return error codes

    Change-Id: I538b9b143c868d9419709356daf0ffc48e2f0df9
    Closes-Bug: #1932194
    (cherry picked from commit 5c6fd44504e47ddbec3e0c29d454daeda87f86a4)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/masakari 9.1.3

This issue was fixed in the openstack/masakari 9.1.3 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/masakari 10.0.3

This issue was fixed in the openstack/masakari 10.0.3 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/masakari 11.0.1

This issue was fixed in the openstack/masakari 11.0.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/masakari 12.0.0.0rc1

This issue was fixed in the openstack/masakari 12.0.0.0rc1 release candidate.

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.