Switch back to built-in md5 function
hashlib.md5 always supports usedforsecurity argument in Python 3.9 and later. The method in oslo.utils is being deprecated[1]. [1] https://review.opendev.org/c/openstack/oslo.utils/+/930879 Change-Id: I8b426c2803a08c15e078b6f6ea4b462ac3a81f3b
This commit is contained in:
parent
88c2fd905a
commit
4b8a53f4c1
@ -13,12 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import bisect
|
||||
import hashlib
|
||||
import struct
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils.secretutils import md5
|
||||
from oslo_utils import uuidutils
|
||||
import tenacity
|
||||
import tooz.coordination
|
||||
@ -79,7 +79,8 @@ class HashRing(object):
|
||||
@staticmethod
|
||||
def _hash(key):
|
||||
return struct.unpack_from(
|
||||
'>I', md5(str(key).encode(), usedforsecurity=False).digest())[0]
|
||||
'>I',
|
||||
hashlib.md5(str(key).encode(), usedforsecurity=False).digest())[0]
|
||||
|
||||
def _get_position_on_ring(self, key):
|
||||
hashed_key = self._hash(key)
|
||||
|
Loading…
Reference in New Issue
Block a user