Skip to content

Commit

Permalink
set default providers to pcs for debian/ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMeier committed Oct 13, 2024
1 parent 13fc08f commit fe26701
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/cs_clone/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

mk_resource_methods

defaultfor operatingsystem: %i[fedora centos redhat]
defaultfor 'os.family' => %i[redhat debian]

def change_clone_id(type, primitive, id, cib)
xpath = "/cib/configuration/resources/clone[descendant::#{type}[@id='#{primitive}']]"
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/cs_colocation/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
of current primitive colocations on the system; add, delete, or adjust various
aspects.'

defaultfor operatingsystem: %i[fedora centos redhat]
defaultfor 'os.family' => %i[redhat debian]

commands pcs: 'pcs'

Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/cs_commit/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
abstract corosync/pacemaker vs. keepalived. This provider flushes the CIB
generated by previous commands to cluster.'

defaultfor 'os.family' => %i[redhat debian]

commands cibadmin: 'cibadmin'
# Required for block_until_ready
commands pcs: 'pcs'
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/cs_group/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Puppet::Type.type(:cs_group).provide(:pcs, parent: PuppetX::Voxpupuli::Corosync::Provider::Pcs) do
desc 'Provider to add, delete, manipulate primitive groups.'

defaultfor operatingsystem: %i[fedora centos redhat]
defaultfor 'os.family' => %i[redhat debian]

# Path to the pcs binary for interacting with the cluster configuration.
commands pcs: '/usr/sbin/pcs'
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/cs_location/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
of current primitive locations on the system; add, delete, or adjust various
aspects.'

defaultfor operatingsystem: %i[fedora centos redhat]
defaultfor 'os.family' => %i[redhat debian]
has_feature :discovery

commands pcs: 'pcs'
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/cs_order/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
of current primitive start orders on the system; add, delete, or adjust various
aspects.'

defaultfor operatingsystem: %i[fedora centos redhat]
defaultfor 'os.family' => %i[redhat debian]

has_feature :kindness

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/cs_primitive/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

mk_resource_methods

defaultfor operatingsystem: %i[fedora centos redhat]
defaultfor 'os.family' => %i[redhat debian]

# given an XML element (a <primitive> from cibadmin), produce a hash suitible
# for creating a new provider instance.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/cs_property/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
abstract corosync/pacemaker vs. keepalived. This provider will check the state
of Corosync cluster configuration properties.'

defaultfor operatingsystem: %i[fedora centos redhat]
defaultfor 'os.family' => %i[redhat debian]

# Path to the pcs binary for interacting with the cluster configuration.
commands pcs: 'pcs'
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/cs_rsc_defaults/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
abstract corosync/pacemaker vs. keepalived. This provider will check the state
of Corosync global defaults for resource options.'

defaultfor operatingsystem: %i[fedora centos redhat]
defaultfor 'os.family' => %i[redhat debian]

# Path to the pcs binary for interacting with the cluster configuration.
commands pcs: 'pcs'
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/cs_shadow/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
abstract corosync/pacemaker vs. keepalived. This provider initializes a new CIB
to begin tracking cluster changes.'

defaultfor 'os.family' => %i[redhat debian]

commands cibadmin: 'cibadmin'
# Required for block_until_ready
commands pcs: 'pcs'
Expand Down
12 changes: 6 additions & 6 deletions spec/acceptance/cs_commit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class { 'corosync':
primitives => [ 'apache2_vip', 'apache2_service' ],
cib => 'puppet',
notify => Cs_commit['puppet']
}
} ->
cs_commit {
'puppet':
}
Expand Down Expand Up @@ -102,7 +102,7 @@ class { 'corosync':
end

it 'creates the vip resource in the cib' do
command = if fact('default_provider') == 'pcs' && fact('os.name') != 'Ubuntu'
command = if fact('default_provider') == 'pcs'
if Gem::Version.new(fact('pcs_version')) < Gem::Version.new('0.10.0')
'pcs resource show'
else
Expand Down Expand Up @@ -139,7 +139,7 @@ class { 'corosync':
end

it 'creates the vip resource in the shadow cib' do
command = if fact('default_provider') == 'pcs' && fact('os.name') != 'Ubuntu'
command = if fact('default_provider') == 'pcs'
if Gem::Version.new(fact('pcs_version')) < Gem::Version.new('0.10.0')
"pcs resource show -f #{pcs_shadow_cib}"
else
Expand All @@ -154,7 +154,7 @@ class { 'corosync':
end

it 'creates the service resource in the shadow cib' do
command = if fact('default_provider') == 'pcs' && fact('os.name') != 'Ubuntu'
command = if fact('default_provider') == 'pcs'
if Gem::Version.new(fact('pcs_version')) < Gem::Version.new('0.10.0')
"pcs resource show -f #{pcs_shadow_cib}"
else
Expand All @@ -169,7 +169,7 @@ class { 'corosync':
end

it 'creates the colocation in the shadow cib and apache2_vip is the "with" resource' do
command = if fact('default_provider') == 'pcs' && fact('os.name') != 'Ubuntu'
command = if fact('default_provider') == 'pcs'
"pcs cluster cib -f #{pcs_shadow_cib} | grep apache2_vip_with_service"
else
'CIB_shadow=puppet cibadmin --query | grep apache2_vip_with_service'
Expand All @@ -180,7 +180,7 @@ class { 'corosync':
end

it 'creates the colocation in the shadow cib and apache2_service is the main resource' do
command = if fact('default_provider') == 'pcs' && fact('os.name') != 'Ubuntu'
command = if fact('default_provider') == 'pcs'
"pcs cluster cib -f #{pcs_shadow_cib} | grep apache2_vip_with_service"
else
'CIB_shadow=puppet cibadmin --query | grep apache2_vip_with_service'
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
# On Debian-based, service state transitions (restart, stop) hang indefinitely and
# lead to test timeouts if there is a service unit of Type=notify involved.
# Use Type=simple as a workaround. See issue 455.
if host[:hypervisor] =~ %r{(vagrant|docker|container_other)} && fact_on(host, 'os.family') == 'Debian'
if host[:hypervisor] =~ %r{(vagrant|docker)} && fact_on(host, 'os.family') == 'Debian'
on host, 'mkdir /etc/systemd/system/corosync.service.d'
on host, 'echo -e "[Service]\nType=simple" > /etc/systemd/system/corosync.service.d/10-type-simple.conf'
end
# Issue 455: On Centos-based there are recurring problems with the pacemaker systemd service
# refusing to stop its crmd subprocess leading to test timeouts. Force a fast SigKill here.
if host[:hypervisor] =~ %r{(vagrant|docker|container_other)} && fact_on(host, 'os.family') == 'RedHat' && fact_on(host, 'os.release.major') == '7'
if host[:hypervisor] =~ %r{(vagrant|docker)} && fact_on(host, 'os.family') == 'RedHat' && fact_on(host, 'os.release.major') == '7'
on host, 'mkdir /etc/systemd/system/pacemaker.service.d'
on host, 'echo -e "[Service]\nSendSIGKILL=yes\nTimeoutStopSec=60s" > /etc/systemd/system/pacemaker.service.d/10-timeout.conf'
end
Expand Down

0 comments on commit fe26701

Please sign in to comment.