From af78845467853c10a3d1813674f2402ef037bd62 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Wed, 18 Mar 2015 15:09:13 -0700 Subject: [PATCH] Adds default values for section Our documentation says to use "" for section if you want top of file global settings, this defaults to that assumption if the user doesn't provide a section parameter at all. --- README.markdown | 7 +++---- lib/puppet/type/ini_setting.rb | 4 +++- lib/puppet/type/ini_subsetting.rb | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.markdown b/README.markdown index e5f740a66..017e8d715 100644 --- a/README.markdown +++ b/README.markdown @@ -43,7 +43,6 @@ ini_setting { "sample setting": The inifile module tries hard not to manipulate your file any more than it needs to. In most cases, it doesn't affect the original whitespace, comments, ordering, etc. - * Supports comments starting with either '#' or ';'. * Supports either whitespace or no whitespace around '='. * Adds any missing sections to the INI file. @@ -171,7 +170,7 @@ Determines whether the specified setting should exist. Valid options: 'present' ##### `setting` -*Required.* Designates a setting to manage within the specified INI file and section. Valid options: a string. +*Optional.* Designates a section of the specified INI file containing the setting to manage. To manage a global setting (at the beginning of the file, before any named sections) enter "". Defaults to "". Valid options: a string. ##### `value` @@ -202,7 +201,7 @@ Specifies whether the subsetting should be present. Valid options: 'present' and ##### `section` -*Required.* Designates a section of the specified INI file containing the subsetting to manage. To manage a global setting (at the beginning of the file, before any named sections) enter "". Valid options: a string, or "". +*Optional.* Designates a section of the specified INI file containing the setting to manage. To manage a global setting (at the beginning of the file, before any named sections) enter "". Defaults to "". Valid options: a string. ##### `setting` @@ -237,4 +236,4 @@ For more information, see our [module contribution guide.](https://docs.puppetla ###Contributors -To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-inifile/graphs/contributors) \ No newline at end of file +To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-inifile/graphs/contributors) diff --git a/lib/puppet/type/ini_setting.rb b/lib/puppet/type/ini_setting.rb index 662c74c11..b01f327ad 100644 --- a/lib/puppet/type/ini_setting.rb +++ b/lib/puppet/type/ini_setting.rb @@ -10,7 +10,9 @@ end newparam(:section) do - desc 'The name of the section in the ini file in which the setting should be defined.' + desc 'The name of the section in the ini file in which the setting should be defined.' + + 'If not provided, defaults to global, top of file, sections.' + defaultto("") end newparam(:setting) do diff --git a/lib/puppet/type/ini_subsetting.rb b/lib/puppet/type/ini_subsetting.rb index 0db073850..c1d6f08ba 100644 --- a/lib/puppet/type/ini_subsetting.rb +++ b/lib/puppet/type/ini_subsetting.rb @@ -10,7 +10,9 @@ end newparam(:section) do - desc 'The name of the section in the ini file in which the setting should be defined.' + desc 'The name of the section in the ini file in which the setting should be defined.' + + 'If not provided, defaults to global, top of file, sections.' + defaultto("") end newparam(:setting) do