From 12d56eff1cd7cdaa52785d186a839489f399ee4e Mon Sep 17 00:00:00 2001 From: GF <32237768+gf-mse@users.noreply.github.com> Date: Mon, 13 Mar 2023 14:06:44 +1100 Subject: [PATCH] python3 strings are Unicode already, so no need to .decode() for python3 // using duck typing to decide -- if there is a .decode() method, then we assume python2 and apply it; doing nothing otherwise --- ceph_deploy/osd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ceph_deploy/osd.py b/ceph_deploy/osd.py index cece242c..0d07bf38 100644 --- a/ceph_deploy/osd.py +++ b/ceph_deploy/osd.py @@ -372,7 +372,9 @@ def disk_list(args, cfg): command, ) for line in out: - line = line.decode('utf-8') + _decode = getattr(line, 'decode', None) + if _decode: + line = _decode('utf-8') if line.startswith('Disk /'): distro.conn.logger.info(line)