From 3619aff7c6a651e9eeba5ec2c6f092cb2853d379 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Mon, 12 Sep 2016 10:33:57 +0200 Subject: [PATCH] Autorequire primitives and clone in cs_location Signed-off-by: Julien Pivotto --- lib/puppet/type/cs_location.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/puppet/type/cs_location.rb b/lib/puppet/type/cs_location.rb index 2a437104..78ce1618 100644 --- a/lib/puppet/type/cs_location.rb +++ b/lib/puppet/type/cs_location.rb @@ -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.'