From 294dd732efc8ae1ba4db46c5a0086a80f3864891 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Mon, 6 May 2019 11:34:10 -0400 Subject: [PATCH] gatherkeys: ensure decoded strings are used when writing to a file Signed-off-by: Alfredo Deza Resolves: rm#39489 --- ceph_deploy/gatherkeys.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ceph_deploy/gatherkeys.py b/ceph_deploy/gatherkeys.py index f90f7f2..8d0bd60 100644 --- a/ceph_deploy/gatherkeys.py +++ b/ceph_deploy/gatherkeys.py @@ -9,6 +9,7 @@ import time from ceph_deploy import hosts from ceph_deploy.cliutil import priority from ceph_deploy.lib import remoto +from ceph_deploy.util import as_string import ceph_deploy.util.paths.mon LOG = logging.getLogger(__name__) @@ -143,7 +144,7 @@ def gatherkeys_missing(args, distro, rlogger, keypath, keytype, dest_dir): keyring_path_local = os.path.join(dest_dir, keyring_name_local) with open(keyring_path_local, 'w') as f: for line in out: - f.write(line + '\n') + f.write(as_string(line) + '\n') return True @@ -162,7 +163,7 @@ def gatherkeys_with_mon(args, host, dest_dir): mon_name_local = keytype_path_to(args, "mon") mon_path_local = os.path.join(dest_dir, mon_name_local) with open(mon_path_local, 'w') as f: - f.write(mon_key) + f.write(as_string(mon_key)) rlogger = logging.getLogger(host) path_asok = ceph_deploy.util.paths.mon.asok(args.cluster, remote_hostname) out, err, code = remoto.process.check( -- 2.47.3