]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/ssh: Install SSH public key in Vagrantfile box fails
authorVolker Theile <vtheile@suse.com>
Mon, 11 Nov 2019 09:15:18 +0000 (10:15 +0100)
committerVolker Theile <vtheile@suse.com>
Mon, 11 Nov 2019 09:26:21 +0000 (10:26 +0100)
The current implementation to copy the host users SSH public key into the Vagrant box does not work with Vagrant 2.2.6.

Signed-off-by: Volker Theile <vtheile@suse.com>
src/pybind/mgr/ssh/Vagrantfile

index 84644ffd3d274c151fbc1aac13ca865a063b4e38..e041afe11d6e37591e2cdb046d336d41c9c643d7 100644 (file)
@@ -23,11 +23,11 @@ Vagrant.configure("2") do |config|
     end
   end
 
-  config.vm.provision "shell" do |s|
-    ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip
-    s.inline = "echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys"
-    s.inline = "sudo cp -r /home/vagrant/.ssh /root/.ssh"
-  end
+  config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/id_rsa.pub"
+  config.vm.provision "shell", inline: <<-SHELL
+    cat /home/vagrant/.ssh/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys
+    sudo cp -r /home/vagrant/.ssh /root/.ssh
+  SHELL
 
   config.vm.provision "shell", inline: <<-SHELL
     sudo yum install -y yum-utils