class Puppet::Settings::FileSetting::Service

A “service” user or group that picks up values from settings when the referenced user or group is safe to use (it exists or will be created), and uses the given fallback value when not safe.

@api private

Public Class Methods

new(name, fallback, settings, available_method) click to toggle source

@param name [Symbol] the name of the setting to use as the service value @param fallback [String, nil] the value to use when the service value cannot be used @param settings [Puppet::Settings] the puppet settings object @param available_method [Symbol] the name of the method to call on

settings to determine if the value in settings is available on the system
# File lib/puppet/settings/file_setting.rb, line 37
def initialize(name, fallback, settings, available_method)
  @settings = settings
  @available_method = available_method
  @name = name
  @fallback = fallback
end

Public Instance Methods

value() click to toggle source
# File lib/puppet/settings/file_setting.rb, line 44
def value
  if safe_to_use_settings_value?
    @settings[@name]
  else
    @fallback
  end
end