Class: Facter::OptionStore

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/framework/core/options/option_store.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.blockObject

Returns the value of attribute block.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def block
  @block
end

.block_listObject

Returns the value of attribute block_list.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def block_list
  @block_list
end

.blocked_factsObject

Returns the value of attribute blocked_facts.



29
30
31
# File 'lib/facter/framework/core/options/option_store.rb', line 29

def blocked_facts
  @blocked_facts
end

.cacheObject

Returns the value of attribute cache.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def cache
  @cache
end

.cliObject

Returns the value of attribute cli.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def cli
  @cli
end

.colorObject

Returns the value of attribute color.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def color
  @color
end

.configObject

Returns the value of attribute config.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def config
  @config
end

.config_file_custom_dirObject

Returns the value of attribute config_file_custom_dir.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def config_file_custom_dir
  @config_file_custom_dir
end

.config_file_external_dirObject

Returns the value of attribute config_file_external_dir.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def config_file_external_dir
  @config_file_external_dir
end

.custom_factsObject

Returns the value of attribute custom_facts.



29
30
31
# File 'lib/facter/framework/core/options/option_store.rb', line 29

def custom_facts
  @custom_facts
end

.debugObject

Returns the value of attribute debug.



29
30
31
# File 'lib/facter/framework/core/options/option_store.rb', line 29

def debug
  @debug
end

.default_external_dirObject

Returns the value of attribute default_external_dir.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def default_external_dir
  @default_external_dir
end

.external_dirObject



58
59
60
61
62
# File 'lib/facter/framework/core/options/option_store.rb', line 58

def external_dir
  return fallback_external_dir if @external_dir.empty? && @external_facts

  @external_dir
end

.external_factsObject

Returns the value of attribute external_facts.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def external_facts
  @external_facts
end

.fact_groupsObject

Returns the value of attribute fact_groups.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def fact_groups
  @fact_groups
end

.hamlObject

Returns the value of attribute haml.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def haml
  @haml
end

.jsonObject

Returns the value of attribute json.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def json
  @json
end

.log_levelObject

Returns the value of attribute log_level.



29
30
31
# File 'lib/facter/framework/core/options/option_store.rb', line 29

def log_level
  @log_level
end

.puppetObject

Returns the value of attribute puppet.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def puppet
  @puppet
end

.rubyObject

Returns the value of attribute ruby.



29
30
31
# File 'lib/facter/framework/core/options/option_store.rb', line 29

def ruby
  @ruby
end

.show_legacyObject

Returns the value of attribute show_legacy.



29
30
31
# File 'lib/facter/framework/core/options/option_store.rb', line 29

def show_legacy
  @show_legacy
end

.strictObject

Returns the value of attribute strict.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def strict
  @strict
end

.timingObject

Returns the value of attribute timing.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def timing
  @timing
end

.traceObject

Returns the value of attribute trace.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def trace
  @trace
end

.ttlsObject

Returns the value of attribute ttls.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def ttls
  @ttls
end

.user_queryObject

Returns the value of attribute user_query.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def user_query
  @user_query
end

.verboseObject

Returns the value of attribute verbose.



29
30
31
# File 'lib/facter/framework/core/options/option_store.rb', line 29

def verbose
  @verbose
end

.yamlObject

Returns the value of attribute yaml.



32
33
34
# File 'lib/facter/framework/core/options/option_store.rb', line 32

def yaml
  @yaml
end

Class Method Details

.allObject



39
40
41
42
43
44
45
46
# File 'lib/facter/framework/core/options/option_store.rb', line 39

def all
  options = {}
  instance_variables.each do |iv|
    variable_name = iv.to_s.delete('@')
    options[variable_name.to_sym] = OptionStore.send(variable_name.to_sym)
  end
  options
end

.custom_dirObject



70
71
72
73
74
# File 'lib/facter/framework/core/options/option_store.rb', line 70

def custom_dir
  return @config_file_custom_dir unless @custom_dir.any?

  @custom_dir
end

.custom_dir=(*dirs) ⇒ Object



76
77
78
79
80
81
# File 'lib/facter/framework/core/options/option_store.rb', line 76

def custom_dir=(*dirs)
  @ruby = true

  @custom_dir = [*dirs]
  @custom_dir.flatten!
end

.fallback_external_dirObject



166
167
168
169
170
# File 'lib/facter/framework/core/options/option_store.rb', line 166

def fallback_external_dir
  return @config_file_external_dir if @config_file_external_dir.any?

  @default_external_dir
end

.resetObject



139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/facter/framework/core/options/option_store.rb', line 139

def reset
  @debug = false
  @verbose = false
  # TODO: constant is not yet available when running puppet facts
  @log_level = :warn
  @show_legacy = true
  @block = true
  @ruby = true
  @user_query = []
  @cli = nil
  @cache = true
  @trace = false
  reset_config
end

.reset_configObject



154
155
156
157
158
159
160
161
162
163
164
# File 'lib/facter/framework/core/options/option_store.rb', line 154

def reset_config
  @custom_dir = []
  @custom_facts = true
  @external_dir = []
  @default_external_dir = []
  @external_facts = true
  @blocked_facts = []
  @fact_groups = {}
  @block_list = {}
  @timing = false
end

.set(key, value) ⇒ Object



135
136
137
# File 'lib/facter/framework/core/options/option_store.rb', line 135

def set(key, value)
  send("#{key}=".to_sym, value)
end