Merge "Fix placement URL"
This commit is contained in:
commit
5f7e937972
|
@ -63,13 +63,13 @@ class nova::keystone::auth_placement(
|
|||
$region = 'RegionOne',
|
||||
$tenant = 'services',
|
||||
$email = 'placement@localhost',
|
||||
$public_url = 'http://127.0.0.1/placement',
|
||||
$internal_url = 'http://127.0.0.1/placement',
|
||||
$admin_url = 'http://127.0.0.1/placement',
|
||||
$public_url = $::nova::params::placement_public_url,
|
||||
$internal_url = $::nova::params::placement_internal_url,
|
||||
$admin_url = $::nova::params::placement_admin_url,
|
||||
$configure_endpoint = true,
|
||||
$configure_user = true,
|
||||
$configure_user_role = true,
|
||||
) {
|
||||
) inherits nova::params {
|
||||
|
||||
include ::nova::deps
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@ class nova::params {
|
|||
$nova_log_group = 'root'
|
||||
$nova_wsgi_script_path = '/var/www/cgi-bin/nova'
|
||||
$nova_api_wsgi_script_source = '/usr/bin/nova-api-wsgi'
|
||||
$placement_public_url = 'http://127.0.0.1/placement'
|
||||
$placement_internal_url = 'http://127.0.0.1/placement'
|
||||
$placement_admin_url = 'http://127.0.0.1/placement'
|
||||
$placement_wsgi_script_source = '/usr/bin/nova-placement-api'
|
||||
$placement_httpd_config_file = '/etc/httpd/conf.d/00-nova-placement-api.conf'
|
||||
case $::operatingsystem {
|
||||
|
@ -131,6 +134,9 @@ class nova::params {
|
|||
$virtlock_service_name = undef
|
||||
$virtlog_service_name = undef
|
||||
$placement_service_name = 'nova-placement-api'
|
||||
$placement_public_url = 'http://127.0.0.1'
|
||||
$placement_internal_url = 'http://127.0.0.1'
|
||||
$placement_admin_url = 'http://127.0.0.1'
|
||||
}
|
||||
default: {
|
||||
$spicehtml5proxy_package_name = 'nova-spiceproxy'
|
||||
|
@ -141,6 +147,9 @@ class nova::params {
|
|||
$virtlock_service_name = 'virtlockd'
|
||||
$virtlog_service_name = 'virtlogd'
|
||||
$placement_service_name = 'httpd'
|
||||
$placement_public_url = 'http://127.0.0.1/placement'
|
||||
$placement_internal_url = 'http://127.0.0.1/placement'
|
||||
$placement_admin_url = 'http://127.0.0.1/placement'
|
||||
}
|
||||
}
|
||||
$libvirt_service_name = 'libvirtd'
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe 'nova::keystone::auth_placement' do
|
||||
|
||||
let :params do
|
||||
{:password => 'placement_password'}
|
||||
{ :password => 'placement_password' }
|
||||
end
|
||||
|
||||
let :default_params do
|
||||
|
@ -11,151 +11,185 @@ describe 'nova::keystone::auth_placement' do
|
|||
:service_name => 'placement',
|
||||
:region => 'RegionOne',
|
||||
:tenant => 'services',
|
||||
:email => 'placement@localhost',
|
||||
:public_url => 'http://127.0.0.1/placement',
|
||||
:internal_url => 'http://127.0.0.1/placement',
|
||||
:admin_url => 'http://127.0.0.1/placement' }
|
||||
:email => 'placement@localhost' }
|
||||
end
|
||||
|
||||
context 'with default parameters' do
|
||||
shared_examples 'nova::keystone::auth_placement' do
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to contain_keystone_user('placement').with(
|
||||
:ensure => 'present',
|
||||
:password => 'placement_password'
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_keystone_user('placement').with(
|
||||
:ensure => 'present',
|
||||
:password => 'placement_password'
|
||||
) }
|
||||
it { is_expected.to contain_keystone_user_role('placement@services').with(
|
||||
:ensure => 'present',
|
||||
:roles => ['admin']
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_keystone_user_role('placement@services').with(
|
||||
:ensure => 'present',
|
||||
:roles => ['admin']
|
||||
)}
|
||||
it { is_expected.to contain_keystone_service('placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:description => 'Openstack Placement Service'
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_keystone_service('placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:description => 'Openstack Placement Service'
|
||||
)}
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:public_url => platform_params[:public_url],
|
||||
:admin_url => platform_params[:admin_url],
|
||||
:internal_url => platform_params[:internal_url]
|
||||
)}
|
||||
end
|
||||
|
||||
context 'when setting auth name' do
|
||||
before do
|
||||
params.merge!( :auth_name => 'foo' )
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user('foo').with(
|
||||
:ensure => 'present',
|
||||
:password => 'placement_password'
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_keystone_user_role('foo@services').with(
|
||||
:ensure => 'present',
|
||||
:roles => ['admin']
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_keystone_service('placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:description => 'Openstack Placement Service'
|
||||
)}
|
||||
end
|
||||
|
||||
context 'when overriding endpoint parameters' do
|
||||
before do
|
||||
params.merge!(
|
||||
:region => 'RegionTwo',
|
||||
:public_url => 'https://10.0.0.1:9778',
|
||||
:internal_url => 'https://10.0.0.3:9778',
|
||||
:admin_url => 'https://10.0.0.2:9778',
|
||||
)
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_endpoint('RegionTwo/placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:public_url => params[:public_url],
|
||||
:internal_url => params[:internal_url],
|
||||
:admin_url => params[:admin_url]
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when disabling endpoint configuration' do
|
||||
before do
|
||||
params.merge!( :configure_endpoint => false )
|
||||
end
|
||||
|
||||
it { is_expected.to_not contain_keystone_endpoint('RegionOne/placement::placement') }
|
||||
end
|
||||
|
||||
describe 'when disabling user configuration' do
|
||||
before do
|
||||
params.merge!( :configure_user => false )
|
||||
end
|
||||
|
||||
it { is_expected.to_not contain_keystone_user('placement') }
|
||||
it { is_expected.to contain_keystone_user_role('placement@services') }
|
||||
it { is_expected.to contain_keystone_service('placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:description => 'Openstack Placement Service'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when disabling user and user role configuration' do
|
||||
let :params do
|
||||
{
|
||||
:configure_user => false,
|
||||
:configure_user_role => false,
|
||||
:password => 'placement_password'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to_not contain_keystone_user('placement') }
|
||||
it { is_expected.to_not contain_keystone_user_role('placement@services') }
|
||||
it { is_expected.to contain_keystone_service('placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:description => 'Openstack Placement Service'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when configuring nova-placement and the keystone endpoint' do
|
||||
let :pre_condition do
|
||||
"class { '::nova::keystone::authtoken':
|
||||
password => 'secrete',
|
||||
}
|
||||
class { 'nova::api':}
|
||||
include nova"
|
||||
end
|
||||
|
||||
let :facts do
|
||||
facts.merge({ :osfamily => "Debian"})
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:password => 'test'
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when overriding service names' do
|
||||
let :params do
|
||||
{
|
||||
:service_name => 'nova_service',
|
||||
:password => 'placement_password'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user('placement') }
|
||||
it { is_expected.to contain_keystone_user_role('placement@services') }
|
||||
it { is_expected.to contain_keystone_service('nova_service::placement') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/nova_service::placement') }
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'nova::keystone::auth_placement on Debian' do
|
||||
before do
|
||||
facts.merge!( :os_package_type => 'debian' )
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:public_url => 'http://127.0.0.1/placement',
|
||||
:admin_url => 'http://127.0.0.1/placement',
|
||||
:internal_url => 'http://127.0.0.1/placement'
|
||||
)}
|
||||
|
||||
end
|
||||
|
||||
context 'when setting auth name' do
|
||||
before do
|
||||
params.merge!( :auth_name => 'foo' )
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user('foo').with(
|
||||
:ensure => 'present',
|
||||
:password => 'placement_password'
|
||||
) }
|
||||
|
||||
it { is_expected.to contain_keystone_user_role('foo@services').with(
|
||||
:ensure => 'present',
|
||||
:roles => ['admin']
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_keystone_service('placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:description => 'Openstack Placement Service'
|
||||
)}
|
||||
|
||||
end
|
||||
|
||||
context 'when overriding endpoint parameters' do
|
||||
before do
|
||||
params.merge!(
|
||||
:region => 'RegionTwo',
|
||||
:public_url => 'https://10.0.0.1:9778',
|
||||
:internal_url => 'https://10.0.0.3:9778',
|
||||
:admin_url => 'https://10.0.0.2:9778',
|
||||
)
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_endpoint('RegionTwo/placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:public_url => params[:public_url],
|
||||
:internal_url => params[:internal_url],
|
||||
:admin_url => params[:admin_url]
|
||||
)}
|
||||
|
||||
end
|
||||
|
||||
describe 'when disabling endpoint configuration' do
|
||||
before do
|
||||
params.merge!( :configure_endpoint => false )
|
||||
end
|
||||
|
||||
it { is_expected.to_not contain_keystone_endpoint('RegionOne/placement::placement') }
|
||||
end
|
||||
|
||||
describe 'when disabling user configuration' do
|
||||
before do
|
||||
params.merge!( :configure_user => false )
|
||||
end
|
||||
|
||||
it { is_expected.to_not contain_keystone_user('placement') }
|
||||
it { is_expected.to contain_keystone_user_role('placement@services') }
|
||||
it { is_expected.to contain_keystone_service('placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:description => 'Openstack Placement Service'
|
||||
:public_url => platform_params[:public_url],
|
||||
:admin_url => platform_params[:admin_url],
|
||||
:internal_url => platform_params[:internal_url]
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when disabling user and user role configuration' do
|
||||
let :params do
|
||||
{
|
||||
:configure_user => false,
|
||||
:configure_user_role => false,
|
||||
:password => 'placement_password'
|
||||
}
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
let(:platform_params) do
|
||||
if facts[:os_package_type] == 'debian'
|
||||
{ :public_url => 'http://127.0.0.1',
|
||||
:internal_url => 'http://127.0.0.1',
|
||||
:admin_url => 'http://127.0.0.1' }
|
||||
else
|
||||
{ :public_url => 'http://127.0.0.1/placement',
|
||||
:internal_url => 'http://127.0.0.1/placement',
|
||||
:admin_url => 'http://127.0.0.1/placement' }
|
||||
end
|
||||
end
|
||||
|
||||
it_behaves_like 'nova::keystone::auth_placement'
|
||||
|
||||
if facts[:operatingsystem] == 'Debian'
|
||||
it_behaves_like 'nova::keystone::auth_placement on Debian'
|
||||
end
|
||||
end
|
||||
|
||||
it { is_expected.to_not contain_keystone_user('placement') }
|
||||
it { is_expected.to_not contain_keystone_user_role('placement@services') }
|
||||
it { is_expected.to contain_keystone_service('placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:description => 'Openstack Placement Service'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when configuring nova-placement and the keystone endpoint' do
|
||||
let :pre_condition do
|
||||
"class { '::nova::keystone::authtoken':
|
||||
password => 'secrete',
|
||||
}
|
||||
class { 'nova::api':}
|
||||
include nova"
|
||||
end
|
||||
|
||||
let :facts do
|
||||
@default_facts.merge({ :osfamily => "Debian"})
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:password => 'test'
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when overriding service names' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:service_name => 'nova_service',
|
||||
:password => 'placement_password'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user('placement') }
|
||||
it { is_expected.to contain_keystone_user_role('placement@services') }
|
||||
it { is_expected.to contain_keystone_service('nova_service::placement') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/nova_service::placement') }
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue