From 562e684f5c5f7b4ea0cfb1fca189b29a38f13516 Mon Sep 17 00:00:00 2001 From: Bobby Ryterski Date: Mon, 14 Sep 2015 19:52:31 -0500 Subject: [PATCH] Support all Fog OpenStack options --- README.md | 3 +++ lib/kitchen/driver/openstack.rb | 6 ++++-- spec/kitchen/driver/openstack_spec.rb | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2e8cc1df..e6abb1a3 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,9 @@ driver: The `image_ref` and `flavor_ref` options can be specified as an exact id, an exact name, or as a regular expression matching the name of the image or flavor. +All of Fog's `openstack` options (`openstack_domain_name`, `openstack_project_name`, +...) are supported. This includes support for the OpenStack Identity v3 API. + Test Kitchen 1.4 supports multiple transports, and transports can be configure globally: ```yaml diff --git a/lib/kitchen/driver/openstack.rb b/lib/kitchen/driver/openstack.rb index 56799015..66d9488e 100644 --- a/lib/kitchen/driver/openstack.rb +++ b/lib/kitchen/driver/openstack.rb @@ -118,7 +118,7 @@ def openstack_server provider: 'OpenStack' } required_server_settings.each { |s| server_def[s] = config[s] } - optional_server_settings.each { |s| server_def[s] = config[s] } + optional_server_settings.each { |s| server_def[s] = config[s] if config[s] } # rubocop:disable Metrics/LineLength server_def end @@ -127,7 +127,9 @@ def required_server_settings end def optional_server_settings - [:openstack_tenant, :openstack_region, :openstack_service_name] + Fog::Compute::OpenStack.recognized.select do |k| + k.to_s.start_with?('openstack') + end - required_server_settings end def network diff --git a/spec/kitchen/driver/openstack_spec.rb b/spec/kitchen/driver/openstack_spec.rb index f00f5d8e..334b99a3 100644 --- a/spec/kitchen/driver/openstack_spec.rb +++ b/spec/kitchen/driver/openstack_spec.rb @@ -330,10 +330,10 @@ describe '#optional_server_settings' do it 'returns the optional settings for an OpenStack server' do - expected = [ - :openstack_tenant, :openstack_region, :openstack_service_name + excluded = [ + :openstack_username, :openstack_api_key, :openstack_auth_url ] - expect(driver.send(:optional_server_settings)).to eq(expected) + expect(driver.send(:optional_server_settings)).not_to include(*excluded) end end