Module: Settings
- Included in:
- Utils::WlsAccess
- Defined in:
- lib/utils/settings.rb
Class Method Summary collapse
Instance Method Summary collapse
- #configuration ⇒ Object
- #get_wls_setting_file ⇒ Object
- #read_from_yaml ⇒ Object
- #setting_for(key) ⇒ Object
- #settings ⇒ Object
Class Method Details
.included(parent) ⇒ Object
4 5 6 |
# File 'lib/utils/settings.rb', line 4 def self.included(parent) parent.extend(Settings) end |
Instance Method Details
#configuration ⇒ Object
12 13 14 |
# File 'lib/utils/settings.rb', line 12 def configuration @configuration ||= read_from_yaml end |
#get_wls_setting_file ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/utils/settings.rb', line 28 def get_wls_setting_file wls_setting_file = Facter.value('override_wls_setting_file') if wls_setting_file.nil? Puppet.debug 'wls_setting_file is default to /etc/wls_setting.yaml' else Puppet.debug "wls_setting_file is overridden to #{wls_setting_file}" return wls_setting_file end '/etc/wls_setting.yaml' end |
#read_from_yaml ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/utils/settings.rb', line 20 def read_from_yaml if File.exist?(config_file) open(config_file) { |f| YAML.load(f) } else Hash['default', {}] end end |
#setting_for(key) ⇒ Object
8 9 10 |
# File 'lib/utils/settings.rb', line 8 def setting_for(key) settings[key] end |
#settings ⇒ Object
16 17 18 |
# File 'lib/utils/settings.rb', line 16 def settings configuration[environment] end |