From 0baa2b801a6938889fb1ded2c8bf1609ca616cff Mon Sep 17 00:00:00 2001 From: Timothy Asir Jeyasingh Date: Wed, 13 May 2020 20:41:41 +0530 Subject: [PATCH] Fix unicode error in VMWare Signed-off-by: Timothy Asir Jeyasingh --- tendrl/node_agent/node_sync/disk_sync.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tendrl/node_agent/node_sync/disk_sync.py b/tendrl/node_agent/node_sync/disk_sync.py index 1f6adb8d..8b9adf3f 100644 --- a/tendrl/node_agent/node_sync/disk_sync.py +++ b/tendrl/node_agent/node_sync/disk_sync.py @@ -123,7 +123,7 @@ def get_disk_details(): cmd = cmd_utils.Command('hwinfo --disk') out, err, rc = cmd.run() if not err: - out = out.encode('utf8') + out = unicode(out, errors="ignore").encode('utf8') for all_disks in out.split('\n\n'): devlist = {"disk_id": "", "hardware_id": "", @@ -256,7 +256,7 @@ def get_node_block_devices(disks_map): cmd = cmd_utils.Command(lsblk) out, err, rc = cmd.run() if not err: - out = out.encode('utf8') + out = unicode(out, errors="ignore").encode('utf8') devlist = map( lambda line: dict(zip(keys, line.split(' '))), out.splitlines()) @@ -345,7 +345,7 @@ def get_raw_reference(): cmd = cmd_utils.Command("ls -l %s" % full_path) out, err, rc = cmd.run() if not err: - out = out.encode('utf8') + out = unicode(out, errors="ignore").encode('utf8') count = 0 for line in out.split('\n'): if count == 0: