summaryrefslogtreecommitdiff
path: root/lib/puppet/util/ini_file.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/util/ini_file.rb')
-rw-r--r--lib/puppet/util/ini_file.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/puppet/util/ini_file.rb b/lib/puppet/util/ini_file.rb
index 90b0c7b..b6927f9 100644
--- a/lib/puppet/util/ini_file.rb
+++ b/lib/puppet/util/ini_file.rb
@@ -23,6 +23,14 @@ module Util
@section_names
end
+ def get_settings(section_name)
+ section = @sections_hash[section_name]
+ section.setting_names.inject({}) do |result, setting|
+ result[setting] = section.get_value(setting)
+ result
+ end
+ end
+
def get_value(section_name, setting)
if (@sections_hash.has_key?(section_name))
@sections_hash[section_name].get_value(setting)
@@ -256,7 +264,7 @@ module Util
def insert_inline_setting_line(result, section, setting, value)
line_num = result[:line_num]
match = result[:match]
- lines.insert(line_num + 1, "#{' ' * section.indentation}#{setting}#{match[4]}#{value}")
+ lines.insert(line_num + 1, "#{' ' * (section.indentation || 0 )}#{setting}#{match[4]}#{value}")
end
# Utility method; given a section index (index into the @section_names