mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
make ssh tests work with vagrant ssh user
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
parent
5ed71ef444
commit
3858606fb7
2 changed files with 4 additions and 8 deletions
|
@ -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
|
||||||
|
|
|
@ -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']
|
||||||
|
|
Loading…
Reference in a new issue