refactor quantum configuration
add openstack::quantum manifest that can
be used to configure various quantum roles.
updates the fixtures file to use the latest quantum
from stackforge.
also updates how quantum integrates into the other
modules
    openstack::controller
* public and private interface are no longer required
* quantum user and db password should not have defaults
(but also not be required)
* change rabbit user
* ovs_local_ip defaults to internal address
* add quantum configuration to controller
    openstack::compute
* add quantum_host (b/c it is difference from
keystone host)
* allow setting service username and tenant
* set correct vif driver
* user the quantum openstack class
* default ovs_local_ip to internal address
* change rabbit username to not default to nova
(more services are not using it)
    nova::controller
* add metadata and quantum user params
* add quantum_md_proxy secret to nova::api
* only require public and private interfaces for
nova-networks
* only configure nova compute components related to
quantum
Change-Id: I9dc1628fbb493fd93bfd602b1c6e33c01ad46d96
			
			
This commit is contained in:
		@@ -32,7 +32,7 @@ describe 'openstack::compute' do
 | 
			
		||||
      should contain_class('nova').with(
 | 
			
		||||
        :sql_connection      => 'mysql://user:pass@host/dbname',
 | 
			
		||||
        :rabbit_host         => '127.0.0.1',
 | 
			
		||||
        :rabbit_userid       => 'nova',
 | 
			
		||||
        :rabbit_userid       => 'openstack',
 | 
			
		||||
        :rabbit_password     => 'rabbit_pw',
 | 
			
		||||
        :rabbit_virtual_host => '/',
 | 
			
		||||
        :image_service       => 'nova.image.glance.GlanceImageService',
 | 
			
		||||
@@ -68,7 +68,7 @@ describe 'openstack::compute' do
 | 
			
		||||
      should contain_class('openstack::cinder::storage').with(
 | 
			
		||||
        :sql_connection      => 'mysql://user:pass@host/dbcinder',
 | 
			
		||||
        :rabbit_password     => 'rabbit_pw',
 | 
			
		||||
        :rabbit_userid       => 'nova',
 | 
			
		||||
        :rabbit_userid       => 'openstack',
 | 
			
		||||
        :rabbit_host         => '127.0.0.1',
 | 
			
		||||
        :rabbit_virtual_host => '/',
 | 
			
		||||
        :volume_group        => 'cinder-volumes',
 | 
			
		||||
@@ -165,6 +165,7 @@ describe 'openstack::compute' do
 | 
			
		||||
          'enabled' => true,
 | 
			
		||||
          'install_service' => true
 | 
			
		||||
        })
 | 
			
		||||
        should_not contain_class('openstack::quantum')
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      describe 'with defaults' do
 | 
			
		||||
@@ -241,32 +242,48 @@ describe 'openstack::compute' do
 | 
			
		||||
        :internal_address      => '127.0.0.1',
 | 
			
		||||
        :public_interface      => 'eth3',
 | 
			
		||||
        :quantum               => true,
 | 
			
		||||
        :keystone_host         => '127.0.0.1',
 | 
			
		||||
        :quantum_host          => '127.0.0.1',
 | 
			
		||||
        :keystone_host         => '127.0.0.3',
 | 
			
		||||
        :quantum_host          => '127.0.0.2',
 | 
			
		||||
        :quantum_user_password => 'quantum_user_password'
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'should configure quantum' do
 | 
			
		||||
      should contain_class('quantum').with(
 | 
			
		||||
        :verbose         => false,
 | 
			
		||||
        :debug           => false,
 | 
			
		||||
        :rabbit_host     => params[:rabbit_host],
 | 
			
		||||
        :rabbit_password => params[:rabbit_password]
 | 
			
		||||
      should contain_class('openstack::quantum').with(
 | 
			
		||||
        :db_host           => '127.0.0.1',
 | 
			
		||||
        :ovs_local_ip      => params[:internal_address],
 | 
			
		||||
        :rabbit_host       => params[:rabbit_host],
 | 
			
		||||
        :rabbit_user       => 'openstack',
 | 
			
		||||
        :rabbit_password   => params[:rabbit_password],
 | 
			
		||||
        :enable_ovs_agent  => true,
 | 
			
		||||
        :firewall_driver   => false,
 | 
			
		||||
        :enable_l3_agent   => false,
 | 
			
		||||
        :enable_dhcp_agent => false,
 | 
			
		||||
        :auth_url          => 'http://127.0.0.1:35357/v2.0',
 | 
			
		||||
        :user_password     => params[:quantum_user_password],
 | 
			
		||||
        :keystone_host     => params[:keystone_host],
 | 
			
		||||
        :enabled           => true,
 | 
			
		||||
        :enable_server     => false,
 | 
			
		||||
        :verbose           => false
 | 
			
		||||
      )
 | 
			
		||||
      should contain_class('quantum::agents::ovs').with(
 | 
			
		||||
        :enable_tunneling => true,
 | 
			
		||||
        :local_ip         => '127.0.0.1'
 | 
			
		||||
 | 
			
		||||
      should contain_class('nova::compute::quantum').with(
 | 
			
		||||
        :libvirt_vif_driver => 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver'
 | 
			
		||||
      )
 | 
			
		||||
      should contain_class('nova::compute::quantum')
 | 
			
		||||
 | 
			
		||||
      should contain_class('nova::network::quantum').with(
 | 
			
		||||
        :quantum_admin_password    => 'quantum_user_password',
 | 
			
		||||
        :quantum_auth_strategy     => 'keystone',
 | 
			
		||||
        :quantum_url               => "http://127.0.0.1:9696",
 | 
			
		||||
        :quantum_url               => "http://127.0.0.2:9696",
 | 
			
		||||
        :quantum_admin_tenant_name => 'services',
 | 
			
		||||
        :quantum_admin_username    => 'quantum',
 | 
			
		||||
        :quantum_admin_auth_url    => "http://127.0.0.1:35357/v2.0"
 | 
			
		||||
        :quantum_admin_auth_url    => "http://127.0.0.3:35357/v2.0"
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
      should_not contain_class('quantum::server')
 | 
			
		||||
      should_not contain_class('quantum::plugins::ovs')
 | 
			
		||||
      should_not contain_class('quantum::agents::dhcp')
 | 
			
		||||
      should_not contain_class('quantum::agents::l3')
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -64,10 +64,14 @@ describe 'openstack::controller' do
 | 
			
		||||
 | 
			
		||||
      let :params do
 | 
			
		||||
        default_params.merge(
 | 
			
		||||
          :enabled => true,
 | 
			
		||||
          :db_type => 'mysql',
 | 
			
		||||
          :quantum => true,
 | 
			
		||||
          :cinder  => true
 | 
			
		||||
          :enabled                => true,
 | 
			
		||||
          :db_type                => 'mysql',
 | 
			
		||||
          :quantum                => true,
 | 
			
		||||
          :metadata_shared_secret => 'secret',
 | 
			
		||||
          :bridge_interface       => 'eth1',
 | 
			
		||||
          :quantum_user_password  => 'q_pass',
 | 
			
		||||
          :quantum_db_password    => 'q_db_pass',
 | 
			
		||||
          :cinder                 => true
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
@@ -105,7 +109,7 @@ describe 'openstack::controller' do
 | 
			
		||||
         )
 | 
			
		||||
         should contain_class('quantum::db::mysql').with(
 | 
			
		||||
           :user          => 'quantum',
 | 
			
		||||
           :password      => 'quantum_pass',
 | 
			
		||||
           :password      => 'q_db_pass',
 | 
			
		||||
           :dbname        => 'quantum',
 | 
			
		||||
           :allowed_hosts => '%'
 | 
			
		||||
         )
 | 
			
		||||
@@ -341,7 +345,7 @@ describe 'openstack::controller' do
 | 
			
		||||
 | 
			
		||||
      it 'should contain enabled nova services' do
 | 
			
		||||
        should contain_class('nova::rabbitmq').with(
 | 
			
		||||
          :userid       => 'nova',
 | 
			
		||||
          :userid       => 'openstack',
 | 
			
		||||
          :password     => 'rabbit_pw',
 | 
			
		||||
          :virtual_host => '/',
 | 
			
		||||
          :enabled      => true
 | 
			
		||||
@@ -349,7 +353,7 @@ describe 'openstack::controller' do
 | 
			
		||||
        should contain_class('nova').with(
 | 
			
		||||
          :sql_connection      => 'mysql://nova:nova_pass@127.0.0.1/nova',
 | 
			
		||||
          :rabbit_host         => '127.0.0.1',
 | 
			
		||||
          :rabbit_userid       => 'nova',
 | 
			
		||||
          :rabbit_userid       => 'openstack',
 | 
			
		||||
          :rabbit_password     => 'rabbit_pw',
 | 
			
		||||
          :rabbit_virtual_host => '/',
 | 
			
		||||
          :image_service       => 'nova.image.glance.GlanceImageService',
 | 
			
		||||
@@ -479,8 +483,11 @@ describe 'openstack::controller' do
 | 
			
		||||
        default_params.merge({
 | 
			
		||||
          :quantum => true,
 | 
			
		||||
          :verbose => true,
 | 
			
		||||
          :quantum_user_password => 'q_pass',
 | 
			
		||||
          :public_interface      => 'eth_27'
 | 
			
		||||
          :quantum_user_password  => 'q_pass',
 | 
			
		||||
          :bridge_interface       => 'eth_27',
 | 
			
		||||
          :internal_address       => '10.0.0.3',
 | 
			
		||||
          :quantum_db_password    => 'q_db_pass',
 | 
			
		||||
          :metadata_shared_secret => 'secret'
 | 
			
		||||
        })
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
@@ -488,46 +495,31 @@ describe 'openstack::controller' do
 | 
			
		||||
 | 
			
		||||
      it 'should configure quantum' do
 | 
			
		||||
 | 
			
		||||
        should contain_class('quantum').with({
 | 
			
		||||
          :rabbit_user      => 'nova',
 | 
			
		||||
          :rabbit_password  => 'rabbit_pw',
 | 
			
		||||
          :verbose          => true,
 | 
			
		||||
          :debug            => true,
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        should contain_class('quantum::server').with({
 | 
			
		||||
         :auth_password => 'q_pass',
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        should contain_class('quantum::plugins::ovs').with({
 | 
			
		||||
          :sql_connection      => 'mysql://quantum:quantum_pass@127.0.0.1/quantum?charset=utf8',
 | 
			
		||||
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        should contain_class('quantum::agents::ovs').with( {
 | 
			
		||||
          :bridge_uplinks => ["br-ex:eth_27"],
 | 
			
		||||
          :bridge_mappings  => ['external:br-ex'],
 | 
			
		||||
          :enable_tunneling => true,
 | 
			
		||||
          :local_ip         => '127.0.0.1',
 | 
			
		||||
        } )
 | 
			
		||||
 | 
			
		||||
        should contain_class('quantum::agents::dhcp').with( {
 | 
			
		||||
          :use_namespaces => 'False',
 | 
			
		||||
        } )
 | 
			
		||||
 | 
			
		||||
        should contain_class('quantum::agents::l3').with( {
 | 
			
		||||
          :external_network_bridge => 'br-ex',
 | 
			
		||||
          :auth_password           => 'q_pass',
 | 
			
		||||
        } )
 | 
			
		||||
 | 
			
		||||
        should contain_class('nova::network::quantum').with({
 | 
			
		||||
          :quantum_admin_password    => 'q_pass',
 | 
			
		||||
          :quantum_auth_strategy     => 'keystone',
 | 
			
		||||
          :quantum_url               => "http://127.0.0.1:9696",
 | 
			
		||||
          :quantum_admin_tenant_name => 'services',
 | 
			
		||||
          :quantum_admin_username    => 'quantum',
 | 
			
		||||
          :quantum_admin_auth_url    => "http://127.0.0.1:35357/v2.0",
 | 
			
		||||
        })
 | 
			
		||||
        should contain_class('openstack::quantum').with(
 | 
			
		||||
          :db_host               => '127.0.0.1',
 | 
			
		||||
          :rabbit_host           => '127.0.0.1',
 | 
			
		||||
          :rabbit_user           => 'openstack',
 | 
			
		||||
          :rabbit_password       => 'rabbit_pw',
 | 
			
		||||
          :rabbit_virtual_host   => '/',
 | 
			
		||||
          :ovs_local_ip          => '10.0.0.3',
 | 
			
		||||
          :bridge_uplinks        => ["br-ex:eth_27"],
 | 
			
		||||
          :bridge_mappings       => ["default:br-ex"],
 | 
			
		||||
          :enable_ovs_agent      => false,
 | 
			
		||||
          :firewall_driver       => 'quantum.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver',
 | 
			
		||||
          :db_name               => 'quantum',
 | 
			
		||||
          :db_user               => 'quantum',
 | 
			
		||||
          :db_password           => 'q_db_pass',
 | 
			
		||||
          :enable_dhcp_agent     => true,
 | 
			
		||||
          :enable_l3_agent       => true,
 | 
			
		||||
          :enable_metadata_agent => true,
 | 
			
		||||
          :auth_url              => 'http://127.0.0.1:35357/v2.0',
 | 
			
		||||
          :user_password         => 'q_pass',
 | 
			
		||||
          :shared_secret         => 'secret',
 | 
			
		||||
          :keystone_host         => '127.0.0.1',
 | 
			
		||||
          :enabled               => true,
 | 
			
		||||
          :enable_server         => true,
 | 
			
		||||
          :verbose               => true
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										77
									
								
								spec/classes/openstack_nova_controller_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								spec/classes/openstack_nova_controller_spec.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,77 @@
 | 
			
		||||
require 'spec_helper'
 | 
			
		||||
 | 
			
		||||
describe 'openstack::nova::controller' do
 | 
			
		||||
 | 
			
		||||
  let :params do
 | 
			
		||||
    {
 | 
			
		||||
      :public_address         => '127.0.0.1',
 | 
			
		||||
      :db_host                => '127.0.0.1',
 | 
			
		||||
      :rabbit_password        => 'rabbit_pass',
 | 
			
		||||
      :nova_user_password     => 'nova_user_pass',
 | 
			
		||||
      :quantum_user_password  => 'quantum_user_pass',
 | 
			
		||||
      :nova_db_password       => 'nova_db_pass',
 | 
			
		||||
      :quantum                => true,
 | 
			
		||||
      :metadata_shared_secret => 'secret'
 | 
			
		||||
    }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  let :facts do
 | 
			
		||||
    {:osfamily => 'Debian' }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it { should contain_class('openstack::nova::controller') }
 | 
			
		||||
 | 
			
		||||
  context 'when configuring quantum' do
 | 
			
		||||
 | 
			
		||||
    it 'should configure nova with quantum' do
 | 
			
		||||
 | 
			
		||||
      should contain_class('nova::rabbitmq').with(
 | 
			
		||||
        :userid        => 'openstack',
 | 
			
		||||
        :password      => 'rabbit_pass',
 | 
			
		||||
        :enabled       => true,
 | 
			
		||||
        :virtual_host  => '/'
 | 
			
		||||
      )
 | 
			
		||||
      should contain_class('nova').with(
 | 
			
		||||
        :sql_connection       => 'mysql://nova:nova_db_pass@127.0.0.1/nova',
 | 
			
		||||
        :rabbit_userid        => 'openstack',
 | 
			
		||||
        :rabbit_password      => 'rabbit_pass',
 | 
			
		||||
        :rabbit_virtual_host  => '/',
 | 
			
		||||
        :image_service        => 'nova.image.glance.GlanceImageService',
 | 
			
		||||
        :glance_api_servers   => '127.0.0.1:9292',
 | 
			
		||||
        :verbose              => false,
 | 
			
		||||
        :rabbit_host          => '127.0.0.1'
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
      should contain_class('nova::api').with(
 | 
			
		||||
        :enabled                              => true,
 | 
			
		||||
        :admin_tenant_name                    => 'services',
 | 
			
		||||
        :admin_user                           => 'nova',
 | 
			
		||||
        :admin_password                       => 'nova_user_pass',
 | 
			
		||||
        :enabled_apis                         => 'ec2,osapi_compute,metadata',
 | 
			
		||||
        :auth_host                            => '127.0.0.1',
 | 
			
		||||
        :quantum_metadata_proxy_shared_secret => 'secret'
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
      should contain_class('nova::network::quantum').with(
 | 
			
		||||
        :quantum_admin_password    => 'quantum_user_pass',
 | 
			
		||||
        :quantum_auth_strategy     => 'keystone',
 | 
			
		||||
        :quantum_url               => "http://127.0.0.1:9696",
 | 
			
		||||
        :quantum_admin_tenant_name => 'services',
 | 
			
		||||
        :quantum_admin_username    => 'quantum',
 | 
			
		||||
        :quantum_admin_auth_url    => "http://127.0.0.1:35357/v2.0"
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
      ['nova::scheduler', 'nova::objectstore', 'nova::cert', 'nova::consoleauth', 'nova::conductor'].each do |x|
 | 
			
		||||
        should contain_class(x).with_enabled(true)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      should contain_class('nova::vncproxy').with(
 | 
			
		||||
        :host    => '127.0.0.1',
 | 
			
		||||
        :enabled => true
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										145
									
								
								spec/classes/openstack_quantum_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										145
									
								
								spec/classes/openstack_quantum_spec.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,145 @@
 | 
			
		||||
require 'spec_helper'
 | 
			
		||||
 | 
			
		||||
describe 'openstack::quantum' do
 | 
			
		||||
 | 
			
		||||
  let :facts do
 | 
			
		||||
    {:osfamily => 'Redhat'}
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  let :params do
 | 
			
		||||
    {
 | 
			
		||||
      :user_password   => 'q_user_pass',
 | 
			
		||||
      :rabbit_password => 'rabbit_pass',
 | 
			
		||||
      :db_password     => 'bar'
 | 
			
		||||
    }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'install quantum with default settings' do
 | 
			
		||||
    before do
 | 
			
		||||
      params.delete(:db_password)
 | 
			
		||||
    end
 | 
			
		||||
    it 'should fail b/c database password is required' do
 | 
			
		||||
      expect do
 | 
			
		||||
        subject
 | 
			
		||||
      end.to raise_error(Puppet::Error, /db password must be set/)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
  context 'install quantum with default and database password' do
 | 
			
		||||
    it 'should perform default configuration' do
 | 
			
		||||
      should contain_class('quantum').with(
 | 
			
		||||
        :enabled             => true,
 | 
			
		||||
        :bind_host           => '0.0.0.0',
 | 
			
		||||
        :rabbit_host         => '127.0.0.1',
 | 
			
		||||
        :rabbit_virtual_host => '/',
 | 
			
		||||
        :rabbit_user         => 'rabbit_user',
 | 
			
		||||
        :rabbit_password     => 'rabbit_pass',
 | 
			
		||||
        :verbose             => false,
 | 
			
		||||
        :debug               => false
 | 
			
		||||
      )
 | 
			
		||||
      should contain_class('quantum::server').with(
 | 
			
		||||
        :auth_host     => '127.0.0.1',
 | 
			
		||||
        :auth_password => 'q_user_pass'
 | 
			
		||||
      )
 | 
			
		||||
      should contain_class('quantum::plugins::ovs').with(
 | 
			
		||||
        :sql_connection      => "mysql://quantum:bar@127.0.0.1/quantum?charset=utf8",
 | 
			
		||||
        :tenant_network_type => 'gre'
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'when server is disabled' do
 | 
			
		||||
    before do
 | 
			
		||||
      params.merge!(:enable_server => false)
 | 
			
		||||
    end
 | 
			
		||||
    it 'should not configure server' do
 | 
			
		||||
      should_not contain_class('quantum::server')
 | 
			
		||||
      should_not contain_class('quantum::plugins::ovs')
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'when ovs agent is enabled with all required params' do
 | 
			
		||||
    before do
 | 
			
		||||
      params.merge!(
 | 
			
		||||
        :enable_ovs_agent => true,
 | 
			
		||||
        :bridge_uplinks   => ['br-ex:eth0'],
 | 
			
		||||
        :bridge_mappings  => ['default:br-ex'],
 | 
			
		||||
        :ovs_local_ip     => '10.0.0.2'
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
    it { should contain_class('quantum::agents::ovs').with(
 | 
			
		||||
      :bridge_uplinks   => ['br-ex:eth0'],
 | 
			
		||||
      :bridge_mappings  => ['default:br-ex'],
 | 
			
		||||
      :enable_tunneling => true,
 | 
			
		||||
      :local_ip         => '10.0.0.2',
 | 
			
		||||
      :firewall_driver  => 'quantum.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver'
 | 
			
		||||
    )}
 | 
			
		||||
 | 
			
		||||
    context 'without ovs_local_ip' do
 | 
			
		||||
      before do
 | 
			
		||||
        params.delete(:ovs_local_ip)
 | 
			
		||||
      end
 | 
			
		||||
      it 'should fail' do
 | 
			
		||||
        expect do
 | 
			
		||||
          subject
 | 
			
		||||
        end.to raise_error(Puppet::Error, /ovs_local_ip parameter must be set/)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'when dhcp agent is enabled' do
 | 
			
		||||
    before do
 | 
			
		||||
      params.merge!(:enable_dhcp_agent => true)
 | 
			
		||||
    end
 | 
			
		||||
    it { should contain_class('quantum::agents::dhcp').with(
 | 
			
		||||
      :use_namespaces => true
 | 
			
		||||
    ) }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'when l3 agent is enabled' do
 | 
			
		||||
    before do
 | 
			
		||||
      params.merge!(:enable_l3_agent => true)
 | 
			
		||||
    end
 | 
			
		||||
    it { should contain_class('quantum::agents::l3').with(
 | 
			
		||||
      :use_namespaces => true
 | 
			
		||||
    ) }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'when metadata agent is enabled' do
 | 
			
		||||
    before do
 | 
			
		||||
      params.merge!(
 | 
			
		||||
        :enable_metadata_agent => true
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
    it 'should fail' do
 | 
			
		||||
      expect do
 | 
			
		||||
        subject
 | 
			
		||||
      end.to raise_error(Puppet::Error, /Shared secret parameter must be set/)
 | 
			
		||||
    end
 | 
			
		||||
    context 'with a shared secret' do
 | 
			
		||||
      before do
 | 
			
		||||
        params.merge!(
 | 
			
		||||
          :shared_secret => 'foo'
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
      it { should contain_class('quantum::agents::metadata').with(
 | 
			
		||||
        :auth_password  => 'q_user_pass',
 | 
			
		||||
        :shared_secret  => 'foo',
 | 
			
		||||
        :auth_url       => 'http://localhost:35357/v2.0',
 | 
			
		||||
        :metadata_ip    => '127.0.0.1'
 | 
			
		||||
      ) }
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'with invalid db_type' do
 | 
			
		||||
    before do
 | 
			
		||||
      params.merge!(:db_type => 'foo', :db_password => 'bar')
 | 
			
		||||
    end
 | 
			
		||||
    it 'should fail' do
 | 
			
		||||
      expect do
 | 
			
		||||
        subject
 | 
			
		||||
      end.to raise_error(Puppet::Error, /Unsupported db type: foo./)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
		Reference in New Issue
	
	Block a user