diff --git a/lib/puppet/type/cs_group.rb b/lib/puppet/type/cs_group.rb index fc5d4263..3aeb60eb 100644 --- a/lib/puppet/type/cs_group.rb +++ b/lib/puppet/type/cs_group.rb @@ -21,13 +21,21 @@ module Puppet desc "An array of primitives to have in this group. Must be listed in the order that you wish them to start." + # We want this to be an array, even if it has only one + # value. Prior to 4.x (and unless using the future parser in + # 3.x), Puppet would munge single-parameter arrays into scalar + # values. See also + # https://tickets.puppetlabs.com/browse/PUP-1299. + munge do |value| + value = [value] unless value.is_a?(Array) + end + # Have to redefine should= here so we can sort the array that is given to # us by the manifest. While were checking on the class of our value we - # are going to go ahead and do some validation too. The way Corosync - # colocation works we need to only accept two value arrays. + # are going to go ahead and do some validation too. def should=(value) super - raise Puppet::Error, "Puppet::Type::Cs_Group: primitives property must be at least a 2-element array." unless value.is_a? Array and value.length > 1 + raise Puppet::Error, "Puppet::Type::Cs_Group: primitives property must be at least a 1-element array." unless value.is_a? Array and value.length >= 1 @should end end