]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: fix failure when using --apply-spec and --shh-user 40737/head
authorDaniel Pivonka <dpivonka@redhat.com>
Mon, 29 Mar 2021 17:47:11 +0000 (13:47 -0400)
committerDaniel Pivonka <dpivonka@redhat.com>
Fri, 9 Apr 2021 20:56:57 +0000 (16:56 -0400)
ssh-copy-id was being run as the root user because cephadm requires sudo
so it was trying to use the root users ssh keys to copy the cephadm ssh key to the hosts in the spec
this would fail if the root user did not has passwordless ssh to the host being added
solution run ssh-copy-id as the user ssh-user

additionally fix the check to not copy the cephadm ssh key to the bootstrap host

Signed-off-by: Daniel Pivonka <dpivonka@redhat.com>
(cherry picked from commit 33c843f8a275d6f01d824c6fa066fbd771b6e9fc)

src/cephadm/cephadm

index bda708a7052afcd860cf815bc2943762a94306ac..e7510218ccf9667b15a26e9320a47ef1041afd58 100755 (executable)
@@ -3304,7 +3304,7 @@ def command_bootstrap():
                         ssh_key = '/etc/ceph/ceph.pub'
                         if args.ssh_public_key:
                             ssh_key = args.ssh_public_key.name
-                        out, err, code = call_throws(['ssh-copy-id', '-f', '-i', ssh_key, '%s@%s' % (args.ssh_user, split[1])])
+                        out, err, code = call_throws(['sudo', '-u', args.ssh_user, 'ssh-copy-id', '-f', '-i', ssh_key, '-o StrictHostKeyChecking=no', '%s@%s' % (args.ssh_user, split[1])])
 
         mounts = {}
         mounts[pathify(args.apply_spec)] = '/tmp/spec.yml:z'