Sync strutils from oslo-incubator for mask_password fix

This sync pulls in:
   1131b56 Enable mask_password to handle byte code strings

This is needed because Nova commands are hitting the same
problem Cinder was hitting in bug 1368527 which was fixed
by this strutils update in bug 1366189.

This is not needed in kilo because in kilo Nova has moved
to using the oslo.utils library, which has this fix in it.

Closes-bug: #1366189
Change-Id: I983feea4ac26e34032fa66a4b55f0ce42699ba6a
This commit is contained in:
James Carey 2014-10-23 13:24:27 -07:00
parent 2aeee7a807
commit 0bad3b14ab
1 changed files with 6 additions and 1 deletions

View 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