From 7e9039bf516268a6ecde36e2f46d150ba0415c69 Mon Sep 17 00:00:00 2001 From: Lance Bragstad Date: Mon, 28 Nov 2016 17:15:21 +0000 Subject: [PATCH] Make try/except work for passlib 1.6 and 1.7 Change-Id: I126410ce6a57dd298ea5b62a035174eb35d2c138 Related-Bug: 1644263 --- keystone/common/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/keystone/common/utils.py b/keystone/common/utils.py index 0c2c9c6063..c656545090 100644 --- a/keystone/common/utils.py +++ b/keystone/common/utils.py @@ -136,9 +136,10 @@ def hash_password(password): return passlib.hash.sha512_crypt.encrypt( password_utf8, rounds=CONF.crypt_strength) except DeprecationWarning: - # TODO(stevemar): Remove this warning once we switch over to passlib + # TODO(stevemar): Remove this try/except once we switch over to passlib # version 1.7.0 and replace encrypt() with hash() - pass + return passlib.hash.sha512_crypt.hash( + password_utf8, rounds=CONF.crypt_strength) def check_password(password, hashed):