2012-08-13 19:54:01 +02:00
|
|
|
require File.expand_path('../../../util/ini_file', __FILE__)
|
2012-07-29 06:59:54 +02:00
|
|
|
|
|
|
|
Puppet::Type.type(:ini_setting).provide(:ruby) do
|
|
|
|
def exists?
|
2012-08-14 14:38:08 +02:00
|
|
|
ini_file.get_value(resource[:section], resource[:setting]) == resource[:value].to_s
|
2012-07-29 06:59:54 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
ini_file.set_value(resource[:section], resource[:setting], resource[:value])
|
|
|
|
ini_file.save
|
|
|
|
@ini_file = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
def ini_file
|
2012-09-20 00:42:16 +02:00
|
|
|
@ini_file ||= Puppet::Util::IniFile.new(resource[:path],
|
|
|
|
resource[:key_val_separator])
|
2012-07-29 06:59:54 +02:00
|
|
|
end
|
|
|
|
end
|