From 246e3b975c6a0a12b59793afbc25831fb2bafd21 Mon Sep 17 00:00:00 2001 From: Owen Synge Date: Mon, 23 May 2016 19:15:48 +0200 Subject: [PATCH] ceph_deploy.gatherkeys: Normalize hostname We should always use the short hostname for mon interactions. Signed-off-by: Owen Synge --- ceph_deploy/gatherkeys.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ceph_deploy/gatherkeys.py b/ceph_deploy/gatherkeys.py index 08f210f..a7d0981 100644 --- a/ceph_deploy/gatherkeys.py +++ b/ceph_deploy/gatherkeys.py @@ -136,7 +136,8 @@ def gatherkeys_with_mon(args, host, dest_dir): Connect to mon and gather keys if mon is in quorum. """ distro = hosts.get(host, username=args.username) - dir_keytype_mon = ceph_deploy.util.paths.mon.path(args.cluster, host) + remote_hostname = distro.conn.remote_module.shortname() + dir_keytype_mon = ceph_deploy.util.paths.mon.path(args.cluster, remote_hostname) path_keytype_mon = "%s/keyring" % (dir_keytype_mon) mon_key = distro.conn.remote_module.get_file(path_keytype_mon) if mon_key is None: @@ -147,7 +148,7 @@ def gatherkeys_with_mon(args, host, dest_dir): with file(mon_path_local, 'w') as f: f.write(mon_key) rlogger = logging.getLogger(host) - path_asok = ceph_deploy.util.paths.mon.asok(args.cluster, host) + path_asok = ceph_deploy.util.paths.mon.asok(args.cluster, remote_hostname) out, err, code = remoto.process.check( distro.conn, [ @@ -186,11 +187,11 @@ def gatherkeys_with_mon(args, host, dest_dir): rlogger.error("could not find mons in monmap on '%s'", host) return False for mon in mon_map_mons: - if mon.get('name') == host: + if mon.get('name') == remote_hostname: mon_number = mon.get('rank') break if mon_number is None: - rlogger.error("could not find '%s' in monmap", host) + rlogger.error("could not find '%s' in monmap", remote_hostname) return False if not mon_number in mon_quorum: rlogger.error("Not yet quorum for '%s'", host) -- 2.47.3