ConnectionError exception mapped incorrectly

Bug #1492600 reported by Dave Chen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
keystonemiddleware
Fix Released
Medium
Matthew Edmonds
python-keystoneclient
Fix Released
Critical
Lin Hua Cheng

Bug Description

The mapping for ConnectionError to ConnectionRefused have been
remove in a recent cleanup to move all exception to
keystoneclient.exceptions

related commit: 26534dadb1d0be00b87b632a038839ab1c18cfe4

This is a backward incompatible that caused the keystonemiddleware test to fail after KSC was released

2015-09-07 03:41:01.595 | ======================================================================
2015-09-07 03:41:01.595 | FAIL: keystonemiddleware.tests.unit.auth_token.test_auth_token_middleware.v2AuthTokenMiddlewareTest.test_http_error_not_cached_token
2015-09-07 03:41:01.595 | tags: worker-6
2015-09-07 03:41:01.595 | ----------------------------------------------------------------------
2015-09-07 03:41:01.595 | Empty attachments:
2015-09-07 03:41:01.595 | stderr
2015-09-07 03:41:01.595 | stdout
2015-09-07 03:41:01.595 |
2015-09-07 03:41:01.595 | pythonlogging:'': {{{WARNING [keystonemiddleware.auth_token] Authorization failed for token}}}
2015-09-07 03:41:01.595 |
2015-09-07 03:41:01.596 | Traceback (most recent call last):
2015-09-07 03:41:01.596 | File "keystonemiddleware/tests/unit/auth_token/test_auth_token_middleware.py", line 1132, in test_http_error_not_cached_token
2015-09-07 03:41:01.596 | self.assertIsNone(self._get_cached_token(ERROR_TOKEN))
2015-09-07 03:41:01.596 | File "keystonemiddleware/tests/unit/auth_token/test_auth_token_middleware.py", line 1076, in _get_cached_token
2015-09-07 03:41:05.483 | return self.middleware._token_cache.get(token_id)
2015-09-07 03:41:05.483 | File "keystonemiddleware/auth_token/_cache.py", line 261, in get
2015-09-07 03:41:05.484 | raise exc.InvalidToken(_('Token authorization failed'))
2015-09-07 03:41:05.484 | keystonemiddleware.auth_token._exceptions.InvalidToken: Token authorization failed

Additional notes:
ConnectionError exception is not caught by requests.exceptions.ConnectionError [1] which cause the exceptions.ConnectionRefused is not raised. This block the gating of keystonemiddleware.

[1] https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/session.py#L428-L430.
[2] http://logs.openstack.org/13/208213/2/check/gate-keystonemiddleware-python27/3e14ede/console.html

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

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

Changed in python-keystoneclient:
assignee: nobody → Dave Chen (wei-d-chen)
status: New → In Progress
Brant Knudson (blk-u)
Changed in python-keystoneclient:
importance: Undecided → Critical
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in python-keystoneclient:
assignee: Dave Chen (wei-d-chen) → Lin Hua Cheng (lin-hua-cheng)
description: updated
summary: - Session._send_request(...) doesnt catch the exception properly
+ ConnectionError exception mapped incorrectly
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/221543
Committed: https://git.openstack.org/cgit/openstack/python-keystoneclient/commit/?id=c45fd909c37eabe6e3391304f539003aa3bbff2d
Submitter: Jenkins
Branch: master

commit c45fd909c37eabe6e3391304f539003aa3bbff2d
Author: lin-hua-cheng <email address hidden>
Date: Tue Sep 8 16:42:04 2015 -0700

    Adding back exception mapping for ConnectionError

    The mapping for ConnectionError to ConnectionRefused have been
    remove in a recent cleanup to move all exception to
    keystoneclient.exceptions

    related commit: 26534dadb1d0be00b87b632a038839ab1c18cfe4

    Adding the mapping back for backward compatability.

    Change-Id: I6f4627b9cd68615b509d17910fe2c1605e89fc26
    Closes-Bug: #1492600

Changed in python-keystoneclient:
status: In Progress → Fix Committed
Revision history for this message
Matthew Edmonds (edmondsw) wrote :

proposed https://review.openstack.org/#/c/221897 for keystonemiddleware

Changed in keystonemiddleware:
status: New → In Progress
assignee: nobody → Matthew Edmonds (edmondsw)
Revision history for this message
Brant Knudson (blk-u) wrote :

The problem here is that keystonemiddleware is faking out keystoneclient exceptions for the tests, and it didn't fake out keystoneclient correctly. keystoneclient actually raises ConnectionRefused and not ConnectionError.

Brant Knudson (blk-u)
Changed in keystonemiddleware:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystonemiddleware (master)

Reviewed: https://review.openstack.org/221897
Committed: https://git.openstack.org/cgit/openstack/keystonemiddleware/commit/?id=9b63a6af1ecb14d7cbb77ef88ad5d100a6420227
Submitter: Jenkins
Branch: master

commit 9b63a6af1ecb14d7cbb77ef88ad5d100a6420227
Author: Matthew Edmonds <email address hidden>
Date: Wed Sep 9 14:01:51 2015 -0400

    Use ConnectionRefused for auth_token tests

    Auth token unit tests were failing because they were faking
    ConnectionError whereas keystoneclient raises ConnectionRefused. See
    http://git.openstack.org/cgit/openstack/python-keystoneclient/tree/keystoneclient/session.py?id=28138b588224c6b0503620ac2e24bd37dad25370#n430
    This switches to faking ConnectionRefused.

    Change-Id: I635a7255112f654141ae35369ccc6f3aea425740
    Closes-Bug: #1492600

Changed in keystonemiddleware:
status: In Progress → Fix Committed
Changed in python-keystoneclient:
milestone: none → 1.7.1
status: Fix Committed → Fix Released
Changed in keystonemiddleware:
milestone: none → 2.3.0
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-keystoneclient (master)

Change abandoned by Steve Martinelli (<email address hidden>) on branch: master
Review: https://review.openstack.org/220736
Reason: the bug has been fixed and it's been >60 days since a new patch

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.