From: Daniel Pivonka Date: Mon, 19 Apr 2021 21:18:55 +0000 (-0400) Subject: cephadm: provide a way to checkhost connection without /etc/hosts passed the shell X-Git-Tag: v17.1.0~2121^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=35da4de8ee888d54d74d05a9d16345cd5c112d23;p=ceph.git cephadm: provide a way to checkhost connection without /etc/hosts passed the shell Signed-off-by: Daniel Pivonka --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 0a2134a7bb1f..1e86eacd2ed8 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -3167,6 +3167,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', @@ -7517,6 +7519,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 e76d347b2871..5da998eb4b5a 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -1172,7 +1172,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