From: Alfredo Deza Date: Mon, 6 May 2019 15:34:10 +0000 (-0400) Subject: gatherkeys: ensure decoded strings are used when writing to a file X-Git-Tag: v2.1.0~19^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=294dd732efc8ae1ba4db46c5a0086a80f3864891;p=ceph-deploy.git gatherkeys: ensure decoded strings are used when writing to a file Signed-off-by: Alfredo Deza Resolves: rm#39489 --- 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(