Browse Source

Work with pymongo 3.0

pymongo 3.0 renamed mongos_enum to read_pref_mode_from_name which
was causing the unit tests to fail.

Change-Id: Iaa7fd7221c2e6c865633ef342e6b83304a1de655
Closes-Bug: 1441393
(cherry picked from commit 7c3fe6acaef6fc283c383fb79f06e388df6e6926)
tags/2015.1.0rc2
Brant Knudson Doug Hellmann 5 years ago
parent
commit
a3d8ae8f5f
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      keystone/common/cache/backends/mongo.py

+ 6
- 2
keystone/common/cache/backends/mongo.py View File

@@ -360,8 +360,12 @@ class MongoApi(object):

self._assign_data_mainpulator()
if self.read_preference:
self.read_preference = pymongo.read_preferences.mongos_enum(
self.read_preference)
# pymongo 3.0 renamed mongos_enum to read_pref_mode_from_name
f = getattr(pymongo.read_preferences,
'read_pref_mode_from_name', None)
if not f:
f = pymongo.read_preferences.mongos_enum
self.read_preference = f(self.read_preference)
coll.read_preference = self.read_preference
if self.w > -1:
coll.write_concern['w'] = self.w


Loading…
Cancel
Save