Skip to content

Commit

Permalink
Fix #295 - Add a CIb parameter to cs_rsc_defaults
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Pivotto <[email protected]>
Julien Pivotto committed Jun 27, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent f696e89 commit 5588593
Showing 2 changed files with 77 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/puppet/type/cs_rsc_defaults.rb
Original file line number Diff line number Diff line change
@@ -18,6 +18,17 @@
isnamevar
end

newparam(:cib) do
desc "Corosync applies its configuration immediately. Using a CIB allows
you to group multiple primitives and relationships to be applied at
once. This can be necessary to insert complex configurations into
Corosync correctly.
This paramater sets the CIB this rsc_defaults should be created in. A
cs_shadow resource with a title of the same name as this value should
also be added to your manifest."
end

newproperty(:value) do
desc "Value of the property. It is expected that this will be a single
value but we aren't validating string vs. integer vs. boolean because
66 changes: 66 additions & 0 deletions spec/acceptance/cs_rsc_defaults_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'

describe 'corosync' do
if fact('osfamily') == 'Debian'
cert = '-----BEGIN CERTIFICATE-----
MIIDVzCCAj+gAwIBAgIJAJNCo5ZPmKegMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV
BAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg
Q29tcGFueSBMdGQwHhcNMTUwMjI2MjI1MjU5WhcNMTUwMzI4MjI1MjU5WjBCMQsw
CQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZh
dWx0IENvbXBhbnkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
uCPPbDgErGUVs1pKqv59OatjCEU4P9QcmhDYFR7RBN8m08mIqd+RTuiHUKj6C9Rk
vWQ5bYrGQo/+4E0ziAUuUzzITlpIYLVltca6eBhKUqO3Cd0NMRVc2k4nx5948nwv
9FVOIfOOY6BN2ALglfBfLnhObbzJjs6OSZ7bUCpXVPV01t/61Jj3jQ3+R8b7AaoR
mw7j0uWaFimKt/uag1qqKGw3ilieMhHlG0Da5x9WLi+5VIM0t1rcpR58LLXVvXZB
CrQBucm2xhZsz7R76Ai+NL8zhhyzCZidZ2NtJ3E1wzppcSDAfNrru+rcFSlZ4YG+
lMCqZ1aqKWVXmb8+Vg7IkQIDAQABo1AwTjAdBgNVHQ4EFgQULxI68KhZwEF5Q9al
xZmFDR+Beu4wHwYDVR0jBBgwFoAULxI68KhZwEF5Q9alxZmFDR+Beu4wDAYDVR0T
BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAsa0YKPixD6VmDo3pal2qqichHbdT
hUONk2ozzRoaibVocqKx2T6Ho23wb/lDlRUu4K4DMO663uumzI9lNoOewa0MuW1D
J52cejAMVsP3ROOdxBv0HZIVVJ8NLBHNLFOHJEDtvzogLVplzmo59vPAdmQo6eIV
japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52
J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH
NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw=='
File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) }
it 'creates a rsc_defaults' do
pp = <<-EOS
file { '/tmp/ca.pem':
ensure => file,
content => '#{cert}'
} ->
class { 'corosync':
multicast_address => '224.0.0.1',
authkey => '/tmp/ca.pem',
bind_address => '127.0.0.1',
set_votequorum => true,
quorum_members => ['127.0.0.1'],
}
cs_rsc_defaults { 'resource-stickiness':
value => '98898'
}
EOS

apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)

shell('cibadmin --query') do |r|
expect(r.stdout).to match(%r{resource-stickiness.*98898})
end
end

it 'removes the rsc_default' do
pp = <<-EOS
cs_rsc_defaults { 'resource-stickiness':
ensure => absent
}
EOS
apply_manifest(pp, expect_changes: true)
apply_manifest(pp, catch_changes: true)

shell('cibadmin --query') do |r|
expect(r.stdout).not_to match(%r{resource-stickiness.*98898})
end
end
end
end

0 comments on commit 5588593

Please sign in to comment.