diff options
author | Flavio Percoco <fpercoco@redhat.com> | 2013-11-13 21:15:34 +0000 |
---|---|---|
committer | Flavio Percoco <fpercoco@redhat.com> | 2013-11-13 21:15:34 +0000 |
commit | 808c051095e72b8a04c22cfc60d24ea43bb0ff43 (patch) | |
tree | c1f9eb97811879035854984d26c08062f2956530 | |
parent | 97f9bd03701770111bd35ccedfe003c6ff7b90f2 (diff) | |
download | oslo-middleware-808c051095e72b8a04c22cfc60d24ea43bb0ff43.tar.gz |
Revert "Removes generate_uuid from uuidutils"
This reverts commit 571a78a4bb17a753972e5ef90b0bbdff727fcfa7
-rw-r--r-- | openstack/common/middleware/correlation_id.py | 5 | ||||
-rw-r--r-- | tests/unit/middleware/test_correlation_id.py | 9 |
2 files changed, 6 insertions, 8 deletions
diff --git a/openstack/common/middleware/correlation_id.py b/openstack/common/middleware/correlation_id.py index d594c51..bffa0d7 100644 --- a/openstack/common/middleware/correlation_id.py +++ b/openstack/common/middleware/correlation_id.py @@ -17,14 +17,13 @@ """Middleware that attaches a correlation id to WSGI request""" -import uuid - from openstack.common.middleware import base +from openstack.common import uuidutils class CorrelationIdMiddleware(base.Middleware): def process_request(self, req): correlation_id = (req.headers.get("X_CORRELATION_ID") or - str(uuid.uuid4())) + uuidutils.generate_uuid()) req.headers['X_CORRELATION_ID'] = correlation_id diff --git a/tests/unit/middleware/test_correlation_id.py b/tests/unit/middleware/test_correlation_id.py index 9a0d128..f330ada 100644 --- a/tests/unit/middleware/test_correlation_id.py +++ b/tests/unit/middleware/test_correlation_id.py @@ -15,13 +15,12 @@ # License for the specific language governing permissions and limitations # under the License. -import uuid - import mock from openstack.common.fixture import moxstubout from openstack.common.middleware import correlation_id from openstack.common import test +from openstack.common import uuidutils class CorrelationIdMiddlewareTest(test.BaseTestCase): @@ -35,9 +34,9 @@ class CorrelationIdMiddlewareTest(test.BaseTestCase): req = mock.Mock() req.headers = {} - mock_uuid4 = mock.Mock() - mock_uuid4.return_value = "fake_uuid" - self.stubs.Set(uuid, 'uuid4', mock_uuid4) + mock_generate_uuid = mock.Mock() + mock_generate_uuid.return_value = "fake_uuid" + self.stubs.Set(uuidutils, 'generate_uuid', mock_generate_uuid) middleware = correlation_id.CorrelationIdMiddleware(app) middleware(req) |