NotFound neutron errors should have a unique base class

Bug #1247568 reported by Yair Fried
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Expired
Undecided
Unassigned
python-neutronclient
Invalid
Undecided
Unassigned
tempest
Expired
Wishlist
Unassigned

Bug Description

Most of the sever side exception are caught by the client and re-thrown as the general NeutronError. original message and type are still found in the message.

404-{u'NeutronError': {u'message': u'Security group rule 6957532c-ae2c-4273-89c3-11a does not exist', u'type': u'SecurityGroupRuleNotFound', u'detail': u''}}

this makes it impossible to catch unique error types such as NotFound.

for instance: in tempest (tempest/scenario/manager:

             try:
                 # OpenStack resources are assumed to have a delete()
                 # method which destroys the resource...
                 thing.delete()
             except Exception as e:
                 # If the resource is already missing, mission accomplished.
                 if e.__class__.__name__ == 'NotFound':
                     continue
                 raise

this code should catch and dismiss all not found resources, however, since neutronClient doesn't have a unique NotFound type, it fails to catch here.

Revision history for this message
yong sheng gong (gongysh) wrote :

>>> neutron = client.Client('2.0', endpoint_url=OS_URL, token=OS_TOKEN)
>>> try:
... neutron.delete_security_group_rule('122')
... except NeutronClientException as e:
... print e.status_code
...
DEBUG:neutronclient.client:
REQ: curl -i http://172.16.108.1:9696//v2.0/security-group-rules/122.json -X DELETE -H "X-Auth-Token: 71f1495de04c459f920de6f23cecc051" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient"

DEBUG:neutronclient.client:RESP:{'date': 'Mon, 09 Dec 2013 03:14:55 GMT', 'status': '404', 'content-length': '122', 'content-type': 'application/json; charset=UTF-8'} {"NeutronError": {"message": "Security group rule 122 does not exist", "type": "SecurityGroupRuleNotFound", "detail": ""}}

DEBUG:neutronclient.v2_0.client:Error message: {"NeutronError": {"message": "Security group rule 122 does not exist", "type": "SecurityGroupRuleNotFound", "detail": ""}}
404

you can catch e.status_code==404 error consistently.

Changed in python-neutronclient:
status: New → Incomplete
Changed in neutron:
status: New → Incomplete
Revision history for this message
yong sheng gong (gongysh) wrote :

I change the bug into incomplete to get more comments.

Changed in tempest:
status: New → Incomplete
Sean Dague (sdague)
Changed in tempest:
importance: Undecided → Low
importance: Low → Wishlist
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for tempest because there has been no activity for 60 days.]

Changed in tempest:
status: Incomplete → Expired
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for neutron because there has been no activity for 60 days.]

Changed in neutron:
status: Incomplete → Expired
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

This bug is > 172 days without activity. We are unsetting assignee and milestone and setting status to Incomplete in order to allow its expiry in 60 days.

If the bug is still valid, then update the bug status.

Revision history for this message
Reedip (reedip-banerjee-deactivatedaccount) wrote :

A similar fix is already provided for this issue: https://review.openstack.org/#/c/272940/

Revision history for this message
Akihiro Motoki (amotoki) wrote :

neutronclient issue was fixed in more than a year ago in bug 1296148.

Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

This bug is > 180 days without activity. We are unsetting assignee and milestone and setting status to Incomplete in order to allow its expiry in 60 days.

If the bug is still valid, then update the bug status.

Changed in python-neutronclient:
status: Incomplete → Invalid
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.