From 214dec2527f31600d81a4755b4c0572cef0b5631 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Wed, 18 Mar 2015 15:09:13 -0700 Subject: [PATCH 1/3] 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. --- lib/puppet/type/ini_setting.rb | 4 +++- lib/puppet/type/ini_subsetting.rb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/puppet/type/ini_setting.rb b/lib/puppet/type/ini_setting.rb index 662c74c1..b01f327a 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 0db07385..c1d6f08b 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 From 5537c7b634d5e03526b537ffc93a14d5884af823 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Wed, 18 Mar 2015 15:21:14 -0700 Subject: [PATCH 2/3] updates readme to include examples --- README.markdown | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 2a2f8f87..3ae8b75b 100644 --- a/README.markdown +++ b/README.markdown @@ -52,6 +52,18 @@ ini_setting { "sample setting": } ``` +Manage an individual setting in the global (top of the file) section. For example: + +``` +ini_setting { "sample global setting": + ensure => present, + path => '/tmp/foo.ini', + setting => 'aglobalsetting', + value => "Look at me ma! I'm at the top of the file!", +} +``` + + To control multiple values in a setting, use `ini_subsetting`. For example: ``` @@ -152,7 +164,7 @@ If the above code is added, the resulting configured file will contain only line * `provider`: The specific backend to use for this `ini_setting` resource. You will seldom need to specify this --- Puppet usually discovers the appropriate provider for your platform. The only available provider for `ini_setting` is ruby. -* `section`: The name of the INI file section in which the setting should be defined. Add a global section --- settings that appear at the beginning of the file, before any named sections --- by specifying a section name of "". +* `section`: The name of the INI file section in which the setting should be defined. Add a global section --- settings that appear at the beginning of the file, before any named sections --- by either not declaring this parameter or by specifying a section name of "". * `setting`: The name of the INI file setting to be defined. @@ -174,7 +186,7 @@ If the above code is added, the resulting configured file will contain only line * `quote_char`: The character used to quote the entire value of the setting. Valid values are '', '"', and "'". Defaults to ''. -* `section`: The name of the INI file section in which the setting should be defined. Add a global section --- settings that appear at the beginning of the file, before any named sections --- by specifying a section name of "". +* `section`: The name of the INI file section in which the setting should be defined. Add a global section --- settings that appear at the beginning of the file, before any named sections --- by either not declaring this parameter or by specifying a section name of "". * `setting`: The name of the INI file setting to be defined. From 2882d60f97123a0cd6902c7b9460a83c216fcca0 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Wed, 18 Mar 2015 15:22:51 -0700 Subject: [PATCH 3/3] changes wording in global example --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 3ae8b75b..12758379 100644 --- a/README.markdown +++ b/README.markdown @@ -52,7 +52,7 @@ ini_setting { "sample setting": } ``` -Manage an individual setting in the global (top of the file) section. For example: +Manage an individual setting in the global (top of the file) section. For example (note the lack of section parameter): ``` ini_setting { "sample global setting":