Class: Facter::ConfigReader

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/framework/config/config_reader.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.confObject



6
7
8
# File 'lib/facter/framework/config/config_reader.rb', line 6

def conf
  @conf
end

Class Method Details

.block_listObject



14
15
16
# File 'lib/facter/framework/config/config_reader.rb', line 14

def block_list
  @conf['facts'] && @conf['facts']['blocklist']
end

.cliObject



26
27
28
# File 'lib/facter/framework/config/config_reader.rb', line 26

def cli
  @conf['cli']
end

.fact_groupsObject



30
31
32
# File 'lib/facter/framework/config/config_reader.rb', line 30

def fact_groups
  @conf['fact-groups']
end

.globalObject



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.message}")
  @conf = {}
end

.ttlsObject



18
19
20
# File 'lib/facter/framework/config/config_reader.rb', line 18

def ttls
  @conf['facts'] && @conf['facts']['ttls']
end