mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
ceph-volume: create a utf-8 string decoder for py3 compat
Signed-off-by: Alfredo Deza <adeza@redhat.com>
This commit is contained in:
parent
dd4db2f567
commit
b50f1fb552
@ -0,0 +1,10 @@
|
||||
|
||||
def as_string(string):
|
||||
"""
|
||||
Ensure that whatever type of string is incoming, it is returned as an
|
||||
actual string, versus 'bytes' which Python 3 likes to use.
|
||||
"""
|
||||
if isinstance(string, bytes):
|
||||
# we really ignore here if we can't properly decode with utf-8
|
||||
return string.decode('utf-8', 'ignore')
|
||||
return string
|
Loading…
Reference in New Issue
Block a user