From 4e2b68e06529c0b333f98fbd4506bac166a9409d Mon Sep 17 00:00:00 2001 From: Naoki AINOYA Date: Wed, 5 Jun 2013 22:45:51 +0900 Subject: [PATCH 1/2] care about ssh_key option --- lib/kitchen/driver/openstack.rb | 2 +- spec/kitchen/driver/openstack_spec.rb | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/kitchen/driver/openstack.rb b/lib/kitchen/driver/openstack.rb index c6279f9c..33dc2be9 100644 --- a/lib/kitchen/driver/openstack.rb +++ b/lib/kitchen/driver/openstack.rb @@ -47,7 +47,7 @@ def create(state) # As a consequence of IP weirdness, the OpenStack setup() method is # also borked wait_for_sshd(state[:hostname]) ; puts '(ssh ready)' - config[:key_name] or do_ssh_setup(state, config, server) + config[:ssh_key] or config[:key_name] or do_ssh_setup(state, config, server) rescue Fog::Errors::Error, Excon::Errors::Error => ex raise ActionFailed, ex.message end diff --git a/spec/kitchen/driver/openstack_spec.rb b/spec/kitchen/driver/openstack_spec.rb index bb56bcb9..71d59188 100644 --- a/spec/kitchen/driver/openstack_spec.rb +++ b/spec/kitchen/driver/openstack_spec.rb @@ -78,7 +78,8 @@ :name => 'puppy', :openstack_tenant => 'that_one', :openstack_region => 'atlantis', - :openstack_service_name => 'the_service' + :openstack_service_name => 'the_service', + :ssh_key => '/path/to/id_rsa' } end @@ -88,6 +89,10 @@ expect(drv[k]).to eq(v) end end + + it 'SSH with user-specified private key' do + expect(driver[:ssh_key]).to eq('/path/to/id_rsa') + end end end From 29dc813b0d4c51b31d40d4cdaa9ca5ed93f5e4d5 Mon Sep 17 00:00:00 2001 From: Naoki AINOYA Date: Wed, 5 Jun 2013 23:48:54 +0900 Subject: [PATCH 2/2] Fix Lines violated style requirements --- lib/kitchen/driver/openstack.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/kitchen/driver/openstack.rb b/lib/kitchen/driver/openstack.rb index 33dc2be9..237de2bf 100644 --- a/lib/kitchen/driver/openstack.rb +++ b/lib/kitchen/driver/openstack.rb @@ -47,7 +47,9 @@ def create(state) # As a consequence of IP weirdness, the OpenStack setup() method is # also borked wait_for_sshd(state[:hostname]) ; puts '(ssh ready)' - config[:ssh_key] or config[:key_name] or do_ssh_setup(state, config, server) + unless config[:ssh_key] or config[:key_name] + do_ssh_setup(state, config, server) + end rescue Fog::Errors::Error, Excon::Errors::Error => ex raise ActionFailed, ex.message end