Add magnum::clients class
magnum configuration contains some service clients configuration section. In order to work properly, magnum requires at least to configure cinder_client/region_name. This patch adds a new manifest magnum::clients that take care of client basic configuration including region_name and endpoint_type. In future, more options can be added. Change-Id: Ic33aba69873e0aeb79546fe25f158604229a54a5
This commit is contained in:
parent
c082497af4
commit
c770219b12
44
manifests/clients.pp
Normal file
44
manifests/clients.pp
Normal file
@ -0,0 +1,44 @@
|
||||
# == Class: magnum::clients
|
||||
#
|
||||
# Manages the clients configuration in magnum server
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*region_name*]
|
||||
# (optional) Region in Identity service catalog to use for communication
|
||||
# with the OpenStack service.
|
||||
# Defaults to RegionOne
|
||||
#
|
||||
# [*endpoint_type*]
|
||||
# (optional) Type of endpoint in Identity service catalog to use for
|
||||
# communication with the the OpenStack service.
|
||||
# Defaults to publicURL
|
||||
#
|
||||
class magnum::clients (
|
||||
$region_name = 'RegionOne',
|
||||
$endpoint_type = 'publicURL',
|
||||
) {
|
||||
|
||||
include ::magnum::params
|
||||
|
||||
magnum_config {
|
||||
'cinder_client/region_name': value => $region_name;
|
||||
'barbican_client/region_name': value => $region_name;
|
||||
'glance_client/region_name': value => $region_name;
|
||||
'heat_client/region_name': value => $region_name;
|
||||
'magnum_client/region_name': value => $region_name;
|
||||
'neutron_client/region_name': value => $region_name;
|
||||
'nova_client/region_name': value => $region_name;
|
||||
}
|
||||
|
||||
magnum_config {
|
||||
'barbican_client/endpoint_type': value => $endpoint_type;
|
||||
'glance_client/endpoint_type': value => $endpoint_type;
|
||||
'heat_client/endpoint_type': value => $endpoint_type;
|
||||
'magnum_client/endpoint_type': value => $endpoint_type;
|
||||
'neutron_client/endpoint_type': value => $endpoint_type;
|
||||
'nova_client/endpoint_type': value => $endpoint_type;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- A new class magnum::clients have been added to configure the OpenStack
|
||||
service clients used by magnum service.
|
@ -80,6 +80,8 @@ describe 'basic magnum' do
|
||||
class { '::magnum::certificates':
|
||||
cert_manager_type => 'local'
|
||||
}
|
||||
|
||||
class { '::magnum::clients': }
|
||||
EOS
|
||||
# Run it twice to test for idempotency
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
|
56
spec/classes/magnum_clients_spec.rb
Normal file
56
spec/classes/magnum_clients_spec.rb
Normal file
@ -0,0 +1,56 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'magnum::clients' do
|
||||
|
||||
shared_examples 'magnum::clients' do
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to contain_magnum_config('cinder_client/region_name').with_value('RegionOne') }
|
||||
it { is_expected.to contain_magnum_config('barbican_client/region_name').with_value('RegionOne') }
|
||||
it { is_expected.to contain_magnum_config('glance_client/region_name').with_value('RegionOne') }
|
||||
it { is_expected.to contain_magnum_config('heat_client/region_name').with_value('RegionOne') }
|
||||
it { is_expected.to contain_magnum_config('magnum_client/region_name').with_value('RegionOne') }
|
||||
it { is_expected.to contain_magnum_config('neutron_client/region_name').with_value('RegionOne') }
|
||||
it { is_expected.to contain_magnum_config('nova_client/region_name').with_value('RegionOne') }
|
||||
it { is_expected.to contain_magnum_config('barbican_client/endpoint_type').with_value('publicURL') }
|
||||
it { is_expected.to contain_magnum_config('glance_client/endpoint_type').with_value('publicURL') }
|
||||
it { is_expected.to contain_magnum_config('heat_client/endpoint_type').with_value('publicURL') }
|
||||
it { is_expected.to contain_magnum_config('magnum_client/endpoint_type').with_value('publicURL') }
|
||||
it { is_expected.to contain_magnum_config('neutron_client/endpoint_type').with_value('publicURL') }
|
||||
it { is_expected.to contain_magnum_config('nova_client/endpoint_type').with_value('publicURL') }
|
||||
end
|
||||
|
||||
context 'with specific parameters' do
|
||||
let :params do
|
||||
{ :region_name => 'RegionTwo',
|
||||
:endpoint_type => 'adminURL',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_magnum_config('cinder_client/region_name').with_value('RegionTwo') }
|
||||
it { is_expected.to contain_magnum_config('barbican_client/region_name').with_value('RegionTwo') }
|
||||
it { is_expected.to contain_magnum_config('glance_client/region_name').with_value('RegionTwo') }
|
||||
it { is_expected.to contain_magnum_config('heat_client/region_name').with_value('RegionTwo') }
|
||||
it { is_expected.to contain_magnum_config('magnum_client/region_name').with_value('RegionTwo') }
|
||||
it { is_expected.to contain_magnum_config('neutron_client/region_name').with_value('RegionTwo') }
|
||||
it { is_expected.to contain_magnum_config('nova_client/region_name').with_value('RegionTwo') }
|
||||
it { is_expected.to contain_magnum_config('barbican_client/endpoint_type').with_value('adminURL') }
|
||||
it { is_expected.to contain_magnum_config('glance_client/endpoint_type').with_value('adminURL') }
|
||||
it { is_expected.to contain_magnum_config('heat_client/endpoint_type').with_value('adminURL') }
|
||||
it { is_expected.to contain_magnum_config('magnum_client/endpoint_type').with_value('adminURL') }
|
||||
it { is_expected.to contain_magnum_config('neutron_client/endpoint_type').with_value('adminURL') }
|
||||
it { is_expected.to contain_magnum_config('nova_client/endpoint_type').with_value('adminURL') }
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
it_configures 'magnum::clients'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user