소스 검색

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.
Chris Barker 9 년 전
부모
커밋
af78845467
3개의 변경된 파일9개의 추가작업 그리고 6개의 파일을 삭제
  1. 3 4
      README.markdown
  2. 3 1
      lib/puppet/type/ini_setting.rb
  3. 3 1
      lib/puppet/type/ini_subsetting.rb

+ 3 - 4
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)
+To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-inifile/graphs/contributors)

+ 3 - 1
lib/puppet/type/ini_setting.rb

@@ -10,7 +10,9 @@ Puppet::Type.newtype(:ini_setting) do
   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

+ 3 - 1
lib/puppet/type/ini_subsetting.rb

@@ -10,7 +10,9 @@ Puppet::Type.newtype(:ini_subsetting) do
   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