Puppet4 support: cluster module
Separate fixes Related-Bug: 1586480 Change-Id: I9fb6fe6a0d0b283af5b6783e022cd5d5052addea
This commit is contained in:
parent
11391d1f2f
commit
bfb4b51834
|
@ -16,3 +16,4 @@ fixtures:
|
|||
xinetd: "#{source_dir}/../xinetd"
|
||||
oslo: "#{source_dir}/../oslo"
|
||||
osnailyfacter: "#{source_dir}/../osnailyfacter"
|
||||
keystone: "#{source_dir}/../keystone"
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
spec/fixtures/modules/*
|
||||
spec/fixtures/*
|
||||
.idea
|
||||
|
|
|
@ -13,6 +13,7 @@ group :development, :test do
|
|||
gem 'puppet-lint-variable_contains_upcase', :require => 'false'
|
||||
gem 'puppet-lint-numericvariable', :require => 'false'
|
||||
gem 'json', :require => 'false'
|
||||
gem 'rspec-puppet-facts', :require => 'false'
|
||||
end
|
||||
|
||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Configure OCF service for NTP managed by corosync/pacemaker
|
||||
#
|
||||
class cluster::ntp_ocf inherits ntp::params {
|
||||
class cluster::ntp_ocf inherits ::ntp {
|
||||
$primitive_type = 'ns_ntp'
|
||||
$complex_type = 'clone'
|
||||
|
||||
|
@ -53,16 +53,5 @@ class cluster::ntp_ocf inherits ntp::params {
|
|||
|
||||
Pcmk_resource["p_${service_name}"] ->
|
||||
Pcmk_colocation['ntp-with-vrouter-ns'] ->
|
||||
Service['ntp']
|
||||
|
||||
if ! defined(Service[$service_name]) {
|
||||
service { $service_name:
|
||||
name => $service_name,
|
||||
enable => true,
|
||||
ensure => 'running',
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
provider => 'pacemaker',
|
||||
}
|
||||
}
|
||||
Service[$service_name]
|
||||
}
|
||||
|
|
|
@ -34,24 +34,11 @@ describe 'cluster::dns_ocf' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:hostname => 'hostname.example.com', }
|
||||
on_supported_os(supported_os: supported_os).each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) { facts.merge common_facts }
|
||||
it_configures 'dns_ocf configuration'
|
||||
end
|
||||
|
||||
it_configures 'dns_ocf configuration'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:hostname => 'hostname.example.com', }
|
||||
end
|
||||
|
||||
it_configures 'dns_ocf configuration'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -6,33 +6,17 @@ describe 'cluster::galera_status' do
|
|||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:hostname => 'hostname.example.com',
|
||||
:physicalprocessorcount => 2,
|
||||
:memorysize_mb => 1024,
|
||||
:openstack_version => {'nova' => 'present' },
|
||||
}
|
||||
on_supported_os(supported_os: supported_os).each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) do
|
||||
facts.merge(common_facts).merge(
|
||||
{
|
||||
:openstack_version => {'nova' => 'present'}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
it_configures 'galera_status configuration'
|
||||
end
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:operatingsystemrelease => '7.1',
|
||||
:operatingsystemmajrelease => '7',
|
||||
:hostname => 'hostname.example.com',
|
||||
:physicalprocessorcount => 2,
|
||||
:memorysize_mb => 1024,
|
||||
:openstack_version => {'nova' => 'present' },
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'galera_status configuration'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,15 @@ require 'spec_helper'
|
|||
|
||||
describe 'cluster::heat_engine' do
|
||||
let(:pre_condition) do
|
||||
"class { '::heat::engine': auth_encryption_key => 'deadb33fdeadb33f' }"
|
||||
<<-eof
|
||||
class { '::heat' :
|
||||
keystone_password => 'test',
|
||||
}
|
||||
|
||||
class { '::heat::engine' :
|
||||
auth_encryption_key => 'deadb33fdeadb33f',
|
||||
}
|
||||
eof
|
||||
end
|
||||
|
||||
shared_examples_for 'cluster::heat_engine configuration' do
|
||||
|
@ -45,40 +53,25 @@ describe 'cluster::heat_engine' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:hostname => 'hostname.example.com',
|
||||
:os_service_default => '<SERVICE DEFAULT>'
|
||||
}
|
||||
end
|
||||
on_supported_os(supported_os: supported_os).each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) { facts.merge(common_facts) }
|
||||
|
||||
let :platform_params do
|
||||
{
|
||||
:engine_service_name => 'heat-engine'
|
||||
}
|
||||
end
|
||||
let :platform_params do
|
||||
if facts[:osfamily] == 'Debian'
|
||||
{
|
||||
:engine_service_name => 'heat-engine'
|
||||
}
|
||||
else
|
||||
{
|
||||
:engine_service_name => 'openstack-heat-engine'
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
it_configures 'cluster::heat_engine configuration'
|
||||
it_configures 'cluster::heat_engine configuration'
|
||||
end
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:hostname => 'hostname.example.com',
|
||||
:os_service_default => '<SERVICE DEFAULT>'
|
||||
}
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{
|
||||
:engine_service_name => 'openstack-heat-engine'
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'cluster::heat_engine configuration'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -62,25 +62,12 @@ describe 'cluster::mysql' do
|
|||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:hostname => 'hostname.example.com', }
|
||||
on_supported_os(supported_os: supported_os).each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) { facts.merge(common_facts) }
|
||||
|
||||
it_configures 'cluster::mysql configuration'
|
||||
end
|
||||
|
||||
it_configures 'cluster::mysql configuration'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:operatingsystemmajrelease => '7',
|
||||
:hostname => 'hostname.example.com', }
|
||||
end
|
||||
|
||||
it_configures 'cluster::mysql configuration'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,23 +5,35 @@ describe 'cluster::ntp_ocf' do
|
|||
shared_examples_for 'ntp_ocf configuration' do
|
||||
|
||||
it 'configures with the default params' do
|
||||
service_name = platform_params[:service_name]
|
||||
should contain_class('cluster::ntp_ocf')
|
||||
should contain_pcmk_resource('p_ntp').with_before(["Pcmk_colocation[ntp-with-vrouter-ns]", "Service[ntp]"])
|
||||
should contain_pcmk_colocation('ntp-with-vrouter-ns').with(
|
||||
should contain_pcmk_resource("p_#{service_name}").with_before(["Pcmk_colocation[ntp-with-vrouter-ns]", "Service[#{service_name}]"])
|
||||
should contain_pcmk_colocation("ntp-with-vrouter-ns").with(
|
||||
:ensure => 'present',
|
||||
:score => 'INFINITY',
|
||||
:first => 'clone_p_vrouter',
|
||||
:second => 'clone_p_ntp')
|
||||
:first => 'clone_p_vrouter',
|
||||
:second => "clone_p_#{service_name}")
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian', }
|
||||
end
|
||||
on_supported_os(supported_os: supported_os).each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) { facts.merge(common_facts) }
|
||||
|
||||
it_configures 'ntp_ocf configuration'
|
||||
let :platform_params do
|
||||
if facts[:osfamily] == 'Debian'
|
||||
{
|
||||
:service_name => 'ntp'
|
||||
}
|
||||
else
|
||||
{
|
||||
:service_name => 'ntpd'
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
it_configures 'ntp_ocf configuration'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -33,28 +33,20 @@ describe 'cluster' do
|
|||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '8',
|
||||
:hostname => 'hostname.example.com', }
|
||||
on_supported_os(supported_os: supported_os).each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) { facts.merge(common_facts) }
|
||||
|
||||
let :packages do
|
||||
if facts[:osfamily] == 'Debian'
|
||||
[ 'crmsh', 'pcs' ]
|
||||
else
|
||||
['crmsh']
|
||||
end
|
||||
end
|
||||
|
||||
it_configures 'cluster configuration'
|
||||
end
|
||||
|
||||
let(:packages) { [ 'crmsh', 'pcs' ] }
|
||||
it_configures 'cluster configuration'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:operatingsystemrelease => '7.2',
|
||||
:hostname => 'hostname.example.com', }
|
||||
end
|
||||
|
||||
let(:packages) { ['crmsh'] }
|
||||
it_configures 'cluster configuration'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -132,15 +132,20 @@ describe 'cluster::rabbitmq_ocf' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:lsbdistid => 'Debian'
|
||||
}
|
||||
end
|
||||
on_supported_os(supported_os: supported_os).each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) { facts.merge(common_facts) }
|
||||
|
||||
it_configures 'rabbitmq_ocf configuration'
|
||||
let :packages do
|
||||
if facts[:osfamily] == 'Debian'
|
||||
[ 'crmsh', 'pcs' ]
|
||||
else
|
||||
['crmsh']
|
||||
end
|
||||
end
|
||||
|
||||
it_configures 'rabbitmq_ocf configuration'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
require 'shared_examples'
|
||||
require 'rspec-puppet-facts'
|
||||
include RspecPuppetFacts
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.alias_it_should_behave_like_to :it_configures, 'configures'
|
||||
|
@ -7,3 +9,22 @@ RSpec.configure do |c|
|
|||
end
|
||||
|
||||
at_exit { RSpec::Puppet::Coverage.report! }
|
||||
|
||||
def supported_os
|
||||
[
|
||||
{
|
||||
'operatingsystem' => 'CentOS',
|
||||
'operatingsystemrelease' => ['7.0'],
|
||||
},
|
||||
{
|
||||
'operatingsystem' => 'Ubuntu',
|
||||
'operatingsystemrelease' => ['14.04', '16.04'],
|
||||
},
|
||||
]
|
||||
end
|
||||
|
||||
def common_facts
|
||||
{
|
||||
:os_service_default => '<SERVICE DEFAULT>',
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue