make ssh tests work with vagrant ssh user

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
Dominik Richter 2015-09-25 00:55:54 +02:00
parent 5ed71ef444
commit 3858606fb7
2 changed files with 4 additions and 8 deletions

View file

@ -47,16 +47,12 @@ execute 'create ssh key' do
not_if 'test -e /root/.ssh/id_rsa' not_if 'test -e /root/.ssh/id_rsa'
end end
remote_file 'copy ssh key to authorized keys' do execute 'add ssh key to vagrant user' do
path '/root/.ssh/authorized_keys' command 'cat /root/.ssh/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys'
source 'file:///root/.ssh/id_rsa.pub'
owner 'root'
group 'root'
mode 0644
end end
execute 'test ssh connection' do execute 'test ssh connection' do
command 'ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa root@localhost "echo 1"' command 'ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa vagrant@localhost "echo 1"'
end end
# execute tests # execute tests

View file

@ -6,7 +6,7 @@ backends = {}
backends[:specinfra_ssh] = proc { backends[:specinfra_ssh] = proc {
backend_conf = Vulcano::Backend.target_config({ backend_conf = Vulcano::Backend.target_config({
'target' => 'ssh://root@localhost', 'target' => 'ssh://vagrant@localhost',
'key_file' => '/root/.ssh/id_rsa', 'key_file' => '/root/.ssh/id_rsa',
}) })
backend_class = Vulcano::Backend.registry['specinfra'] backend_class = Vulcano::Backend.registry['specinfra']