Skip to content

Commit

Permalink
Adds default values for section
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Chris Barker authored and hunner committed Mar 30, 2015
1 parent 57c68ba commit af78845
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 3 additions & 4 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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`

Expand Down Expand Up @@ -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`

Expand Down Expand Up @@ -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)
To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-inifile/graphs/contributors)
4 changes: 3 additions & 1 deletion lib/puppet/type/ini_setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/puppet/type/ini_subsetting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit af78845

Please sign in to comment.