From 1e3375d4d4b922f925a17dec90ab7f8e0caf51ce Mon Sep 17 00:00:00 2001 From: Daniel Pivonka Date: Mon, 19 Apr 2021 17:18:55 -0400 Subject: [PATCH] cephadm: provide a way to checkhost connection without /etc/hosts passed the shell Signed-off-by: Daniel Pivonka (cherry picked from commit 35da4de8ee888d54d74d05a9d16345cd5c112d23) --- src/cephadm/cephadm | 6 ++++++ src/pybind/mgr/cephadm/serve.py | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 305416f0e99d4..8c3fccc0c4515 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -3174,6 +3174,8 @@ class CephContainer: if self.host_network: cmd_args.append('--net=host') + if self.ctx.no_hosts: + cmd_args.append('--no-hosts') if self.privileged: cmd_args.extend([ '--privileged', @@ -7589,6 +7591,10 @@ def _get_parser(): parser_shell.add_argument( 'command', nargs=argparse.REMAINDER, help='command (optional)') + parser_shell.add_argument( + '--no-hosts', + action='store_true', + help='dont pass /etc/hosts through to the container') parser_enter = subparsers.add_parser( 'enter', help='run an interactive shell inside a running daemon container') diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index 78d7e79569f22..e92da1f9fbe21 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -1240,7 +1240,10 @@ To add the cephadm SSH key to the host: > ceph cephadm get-pub-key > ~/ceph.pub > ssh-copy-id -f -i ~/ceph.pub {user}@{addr} -To check that the host is reachable: +To check that the host is reachable open a new shell with the --no-hosts flag: +> cephadm shell --no-hosts + +Then run the following: > ceph cephadm get-ssh-config > ssh_config > ceph config-key get mgr/cephadm/ssh_identity_key > ~/cephadm_private_key > chmod 0600 ~/cephadm_private_key -- 2.39.5