summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/ini_setting/ruby.rb
blob: e44a10776af8ff8230bb838093c3c8970eae8b70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'puppet/util/ini_file'

Puppet::Type.type(:ini_setting).provide(:ruby) do
  def exists?
    ini_file.get_value(resource[:section], resource[:setting]) == resource[:value]
  end

  def create
    ini_file.set_value(resource[:section], resource[:setting], resource[:value])
    ini_file.save
    @ini_file = nil
  end


  private
  def ini_file
    @ini_file ||= Puppet::Util::IniFile.new(resource[:path])
  end
end