Skip to content

Commit

Permalink
Merge pull request #397 from roidelapluie/fix396
Browse files Browse the repository at this point in the history
cs_location should require cs_group
  • Loading branch information
bastelfreak authored Apr 2, 2017
2 parents a340f0d + 1584bff commit 075aa47
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet/type/cs_location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def insync?(is)
%w(corosync pacemaker)
end

[:cs_primitive, :cs_clone].each do |type|
[:cs_primitive, :cs_clone, :cs_group].each do |type|
autorequire(type) do
autos = []
autos << unmunge_cs_primitive(should(:primitive)) if should(:primitive)
Expand Down
24 changes: 24 additions & 0 deletions spec/unit/puppet/type/cs_location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,30 @@
end
end

describe 'establishing autorequires between locations and groups' do
let(:apache_group) { create_cs_group_resource('apache_group', ['apache_vip', 'apache_service']) }
let(:apache_location) { create_cs_location_resource('apache_group') }

before do
create_catalog(apache_group, apache_location)
end

context 'between a location and its group' do
let(:autorequire_relationship) { apache_location.autorequire[0] }

it 'has exactly one autorequire' do
expect(apache_location.autorequire.count).to eq(1)
end

it 'has apache group as source of autorequire' do
expect(autorequire_relationship.source).to eq apache_group
end
it 'has apache location as target of autorequire' do
expect(autorequire_relationship.target).to eq apache_location
end
end
end

describe 'establishing autorequires between location and services' do
let(:pacemaker_service) { create_service_resource('pacemaker') }
let(:corosync_service) { create_service_resource('corosync') }
Expand Down

0 comments on commit 075aa47

Please sign in to comment.