Skip to content

Commit

Permalink
Autorequire primitives and clone in cs_location
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Pivotto <[email protected]>
  • Loading branch information
roidelapluie committed Sep 12, 2016
1 parent 9feb625 commit 3619aff
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/puppet/type/cs_location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,23 @@ def insync?(is)
autos
end

autorequire(:cs_primitive) do
autos = []
autos << @parameters[:primitive].value if @parameters[:primitive]
autos
end

autorequire(:service) do
%w(corosync pacemaker)
end

[:cs_primitive, :cs_clone].each do |type|
autorequire(type) do
[unmunge_cs_primitive(@parameters[:primitive].value)]
end
end

def unmunge_cs_primitive(name)
name = name.split(':')[0]
name = name[3..-1] if name.start_with? 'ms_'

name
end

validate do
if [self[:node_name], self[:rules]].compact.length > 1
raise Puppet::Error, 'Location constraints dictate that node_name and rules cannot co-exist for this type.'
Expand Down

0 comments on commit 3619aff

Please sign in to comment.