lib/puppet/parser/resource.rb
# Accept a parameter from an override.
Accept a parameter from an override.
Accept a parameter from an override .
def override_parameter(param)
    (set_parameter(param) and return) unless current = @parameters[param.name]
    unless param.source.child_of?(current.source)
      msg = "Parameter '#{param.name}' is already set on #{self}"
      msg += " by #{current.source}" if current.source.to_s != ""
      if current.file or current.line
        fields = []
        fields << current.file if current.file
        fields << current.line.to_s if current.line
        msg += " at #{fields.join(":")}"
      end
      msg += "; cannot redefine"
      Puppet.log_exception(ArgumentError.new(), msg)
      raise Puppet::ParseError.new(msg, param.line, param.file)
    end
    if param.add
      param = param.dup
      param.value = [current.value, param.value].flatten
    end
    set_parameter(param)
  end
def override_parameter ( param ) ( set_parameter ( param ) and return ) unless current = @parameters [ param . name ] unless param . source . child_of? ( current . source ) msg = "Parameter '#{param.name}' is already set on #{self}" msg += " by #{current.source}" if current . source . to_s != "" if current . file or current . line fields = [ ] fields << current . file if current . file fields << current . line . to_s if current . line msg += " at #{fields.join(":")}" end msg += "; cannot redefine" Puppet . log_exception ( ArgumentError . new ( ) , msg ) raise Puppet :: ParseError . new ( msg , param . line , param . file ) end if param . add param = param . dup param . value = [ current . value , param . value ] . flatten end set_parameter ( param ) end
Accept a parameter from an override.
Accept a parameter from an override .
# This can happen if the override is defining a new parameter, rather # than replacing an existing one. # The parameter is already set.  Fail if they're not allowed to override it. # If we've gotten this far, we're allowed to override. # Merge with previous value, if the parameter was generated with the +> # syntax.  It's important that we use a copy of the new param instance # here, not the old one, and not the original new one, so that the source # is registered correctly for later overrides but the values aren't # implcitly shared when multiple resources are overrriden at once (see # ticket #3556).
param
<not_specific>