class Kafo::PuppetConfigurer

Attributes

config_path[R]
logger[R]

Public Class Methods

new(config_path, settings = {}) click to toggle source
# File lib/kafo/puppet_configurer.rb, line 7
def initialize(config_path, settings = {})
  @config_path = config_path
  @settings = {'reports' => ''}.merge(settings)
  @logger = KafoConfigure.logger
end

Public Instance Methods

[](key) click to toggle source
# File lib/kafo/puppet_configurer.rb, line 13
def [](key)
  @settings[key]
end
[]=(key, value) click to toggle source
# File lib/kafo/puppet_configurer.rb, line 17
def []=(key, value)
  @settings[key] = value
end
write_config() click to toggle source
# File lib/kafo/puppet_configurer.rb, line 21
def write_config
  @logger.debug("Writing Puppet config file at #{config_path}")
  File.open(config_path, 'w') do |file|
    file.puts '[main]'
    @settings.keys.sort.each do |key|
      file.puts "#{key} = #{@settings[key]}"
    end
  end
end