diff --git a/nova/openstack/common/log.py b/nova/openstack/common/log.py index c95ad3d205ae..cdc439a44294 100644 --- a/nova/openstack/common/log.py +++ b/nova/openstack/common/log.py @@ -263,7 +263,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 diff --git a/nova/openstack/common/strutils.py b/nova/openstack/common/strutils.py index 3c05cf31f5d2..586419f77d4c 100644 --- a/nova/openstack/common/strutils.py +++ b/nova/openstack/common/strutils.py @@ -271,7 +271,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