]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Sync latest strutils from oslo-incubator for mask_password fix
authorJames Carey <jecarey@us.ibm.com>
Tue, 16 Sep 2014 14:13:51 +0000 (14:13 +0000)
committerJay S. Bryant <jsbryant@us.ibm.com>
Tue, 16 Sep 2014 15:41:16 +0000 (10:41 -0500)
This sync pulls in:
   1131b56 Enable mask_password to handle byte code strings

This is the only update since the last sync:
   beca4db Sync latest strutils from oslo-incubator

This is needed to fix a delete volume failure when processutils
calls mask_password with a byte code string.

Change-Id: Ie8a8c8e26abc0e387830bc9246e9a44913ae9b24
Closes-bug: #1368527

cinder/openstack/common/strutils.py

index 6a74c07758c48ec22403bc08589f596624c7a7d1..afe535c612c421b5682f618616d675bb1f1b55fc 100644 (file)
@@ -292,7 +292,12 @@ def mask_password(message, secret="***"):
     >>> mask_password("u'original_password' :   u'aaaaa'")
     "u'original_password' :   u'***'"
     """
-    message = six.text_type(message)
+    try:
+        message = six.text_type(message)
+    except UnicodeDecodeError:
+        # NOTE(jecarey): Temporary fix to handle cases where message is a
+        # byte string.   A better solution will be provided in Kilo.
+        pass
 
     # NOTE(ldbragst): Check to see if anything in message contains any key
     # specified in _SANITIZE_KEYS, if not then just return the message since