From cb5bcca025f9a34ecb9bc72b8fe570e6a63e442d Mon Sep 17 00:00:00 2001
From: James Carey <jecarey@us.ibm.com>
Date: Tue, 16 Sep 2014 14:13:51 +0000
Subject: [PATCH] Sync latest strutils from oslo-incubator for mask_password
 fix

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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/cinder/openstack/common/strutils.py b/cinder/openstack/common/strutils.py
index 6a74c0775..afe535c61 100644
--- a/cinder/openstack/common/strutils.py
+++ b/cinder/openstack/common/strutils.py
@@ -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
-- 
2.45.2