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 35 def initialize(name, fallback, settings, available_method) 36 @settings = settings 37 @available_method = available_method 38 @name = name 39 @fallback = fallback 40 end
Public Instance Methods
value()
click to toggle source
# File lib/puppet/settings/file_setting.rb 42 def value 43 if safe_to_use_settings_value? 44 @settings[@name] 45 else 46 @fallback 47 end 48 end
Private Instance Methods
safe_to_use_settings_value?()
click to toggle source
# File lib/puppet/settings/file_setting.rb 51 def safe_to_use_settings_value? 52 @settings[:mkusers] or @settings.send(@available_method) 53 end