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