From: Sage Weil Date: Fri, 4 Oct 2019 19:31:59 +0000 (-0500) Subject: ceph-daemon: decode utf-8 in run() helper X-Git-Tag: v15.1.0~1313^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=204dba81e0484913de28e144ba1bb99d889cd7b8;p=ceph.git ceph-daemon: decode utf-8 in run() helper Less repetition Signed-off-by: Sage Weil --- diff --git a/src/ceph-daemon b/src/ceph-daemon index fed04feefd4..8a652ec3072 100755 --- a/src/ceph-daemon +++ b/src/ceph-daemon @@ -235,7 +235,7 @@ def extract_uid_gid(): image=args.image, entrypoint='/usr/bin/grep', args=['ceph', '/etc/passwd'], - ).run().decode('utf-8') + ).run() (uid, gid) = out.split(':')[2:4] return (int(uid), int(gid)) @@ -483,7 +483,7 @@ class CephContainer: def run(self): logging.debug(self.run_cmd()) - return subprocess.check_output(self.run_cmd()) + return subprocess.check_output(self.run_cmd()).decode('utf-8') ################################## @@ -509,17 +509,17 @@ def command_bootstrap(): image=args.image, entrypoint='/usr/bin/ceph-authtool', args=['--gen-print-key'], - ).run().decode('utf-8').strip() + ).run().strip() admin_key = CephContainer( image=args.image, entrypoint='/usr/bin/ceph-authtool', args=['--gen-print-key'], - ).run().decode('utf-8').strip() + ).run().strip() mgr_key = CephContainer( image=args.image, entrypoint='/usr/bin/ceph-authtool', args=['--gen-print-key'], - ).run().decode('utf-8').strip() + ).run().strip() keyring = ('[mon.]\n' '\tkey = %s\n' @@ -640,7 +640,7 @@ def command_bootstrap(): volume_mounts={ mon_dir: '/var/lib/ceph/mon/ceph-%s:z' % (mon_id), }, - ).run().decode('utf-8') + ).run() j = json.loads(out) if j.get('mgrmap', {}).get('available', False): break