Class: Facter::ConfigReader
- Inherits:
-
Object
- Object
- Facter::ConfigReader
- Defined in:
- lib/facter/framework/config/config_reader.rb
Class Attribute Summary collapse
Class Method Summary collapse
- .block_list ⇒ Object
- .clear ⇒ Object
- .cli ⇒ Object
- .fact_groups ⇒ Object
- .global ⇒ Object
- .init(config_path = nil) ⇒ Object
- .refresh_config(config_path) ⇒ Object
- .ttls ⇒ Object
Class Attribute Details
.conf ⇒ Object
6 7 8 |
# File 'lib/facter/framework/config/config_reader.rb', line 6 def conf @conf end |
Class Method Details
.block_list ⇒ Object
14 15 16 |
# File 'lib/facter/framework/config/config_reader.rb', line 14 def block_list @conf['facts'] && @conf['facts']['blocklist'] end |
.clear ⇒ Object
41 42 43 |
# File 'lib/facter/framework/config/config_reader.rb', line 41 def clear @conf = {} end |
.cli ⇒ Object
26 27 28 |
# File 'lib/facter/framework/config/config_reader.rb', line 26 def cli @conf['cli'] end |
.fact_groups ⇒ Object
30 31 32 |
# File 'lib/facter/framework/config/config_reader.rb', line 30 def fact_groups @conf['fact-groups'] end |
.global ⇒ Object
22 23 24 |
# File 'lib/facter/framework/config/config_reader.rb', line 22 def global @conf['global'] end |
.init(config_path = nil) ⇒ Object
8 9 10 11 12 |
# File 'lib/facter/framework/config/config_reader.rb', line 8 def init(config_path = nil) config_path ||= default_path refresh_config(config_path) self end |
.refresh_config(config_path) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/facter/framework/config/config_reader.rb', line 34 def refresh_config(config_path) @conf = File.readable?(config_path) ? Hocon.load(config_path) : {} rescue StandardError => e log.warn("Facter failed to read config file #{config_path} with the following error: #{e.}") @conf = {} end |
.ttls ⇒ Object
18 19 20 |
# File 'lib/facter/framework/config/config_reader.rb', line 18 def ttls @conf['facts'] && @conf['facts']['ttls'] end |