diff options
author | James Carey <jecarey@us.ibm.com> | 2014-10-27 14:38:25 -0700 |
---|---|---|
committer | James Carey <jecarey@us.ibm.com> | 2014-10-27 14:41:10 -0700 |
commit | 470ba0a26a8a15211639331d040812b47d745106 (patch) | |
tree | 4a9bfaaa12f970f67ced30064eec0b0089ec07dd | |
parent | b1fca33e5f4c5443389d131a212a058d2306ac23 (diff) | |
download | ceilometer-470ba0a26a8a15211639331d040812b47d745106.tar.gz |
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 Ceilometer 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 Ceilometer has moved
to using the oslo.utils library, which has this fix in it.
Closes-bug: #1366189
Change-Id: I4aacbe8d44f0ae2a649294652a388fbd5e15b4c9
-rw-r--r-- | ceilometer/openstack/common/strutils.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ceilometer/openstack/common/strutils.py b/ceilometer/openstack/common/strutils.py index 9814195d..0305a14d 100644 --- a/ceilometer/openstack/common/strutils.py +++ b/ceilometer/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 |