Method: Puppet::Util::Settings#value

Defined in:
lib/vendor/puppet/util/settings.rb

#value(param, environment = nil) ⇒ Object

Find the correct value using our search path. Optionally accept an environment in which to search before the other configuration sections.



665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
# File 'lib/vendor/puppet/util/settings.rb', line 665

def value(param, environment = nil)
  param = param.to_sym
  environment &&= environment.to_sym

  # Short circuit to nil for undefined parameters.
  return nil unless @config.include?(param)

  # Yay, recursion.
  #self.reparse unless [:config, :filetimeout].include?(param)

  # Check the cache first.  It needs to be a per-environment
  # cache so that we don't spread values from one env
  # to another.
  if cached = @cache[environment||"none"][param]
    return cached
  end

  val = uninterpolated_value(param, environment)

  if param == :code
    # if we interpolate code, all hell breaks loose.
    return val
  end

  # Convert it if necessary
  val = convert(val, environment)

  # And cache it
  @cache[environment||"none"][param] = val
  val
end