From 145eb08b1f5367cda9d0120796ff55ce1363e25c Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Mon, 15 Dec 2014 16:09:24 -0800 Subject: 4.5.0 prep --- CHANGELOG.md | 13 +++++++++++++ metadata.json | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fb73db..8da04af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +##2014-12-15 - Supported Release 4.5.0 +###Summary + +This release improves functionality of the member function and adds improved future parser support. + +####Features +- MODULES-1329: Update member() to allow the variable to be an array. +- Sync .travis.yml, Gemfile, Rakefile, and CONTRIBUTING.md via modulesync + +####Bugfixes +- Fix range() to work with numeric ranges with the future parser +- Accurately express SLES support in metadata.json (was missing 10SP4 and 12) + ##2014-11-10 - Supported Release 4.4.0 ###Summary This release has an overhauled readme, new private manifest function, and fixes many future parser bugs. diff --git a/metadata.json b/metadata.json index f049cfb..bf02176 100644 --- a/metadata.json +++ b/metadata.json @@ -1,10 +1,10 @@ { "name": "puppetlabs-stdlib", - "version": "4.4.0", + "version": "4.5.0", "author": "puppetlabs", "summary": "Puppet Module Standard Library", - "license": "Apache 2.0", - "source": "git://github.com/puppetlabs/puppetlabs-stdlib", + "license": "Apache-2.0", + "source": "https://github.com/puppetlabs/puppetlabs-stdlib", "project_page": "https://github.com/puppetlabs/puppetlabs-stdlib", "issues_url": "https://tickets.puppetlabs.com/browse/MODULES", "operatingsystem_support": [ -- cgit v1.2.3 From ec08c6074994f4e90d10e1a425b1be0fc847ef14 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Mon, 15 Dec 2014 16:21:28 -0800 Subject: Update README for updated member() functionality --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 78839c6..bf953d4 100644 --- a/README.markdown +++ b/README.markdown @@ -312,7 +312,7 @@ returns the value of the resource's parameter. For example, the following code r * `max`: Returns the highest value of all arguments. Requires at least one argument. *Type*: rvalue -* `member`: This function determines if a variable is a member of an array. For example, `member(['a','b'], 'b')` returns 'true', while `member(['a','b'], 'c')` returns 'false'. *Type*: rvalue +* `member`: This function determines if a variable is a member of an array. The variable can be either a string, array, or fixnum. For example, `member(['a','b'], 'b')` and `member(['a','b','c'], ['b','c'])` return 'true', while `member(['a','b'], 'c')` and `member(['a','b','c'], ['c','d'])` return 'false'. *Type*: rvalue * `merge`: Merges two or more hashes together and returns the resulting hash. -- cgit v1.2.3 From c54de9498f2cd317039779b333dcd150a52cca81 Mon Sep 17 00:00:00 2001 From: jbondpdx Date: Thu, 20 Nov 2014 15:20:37 -0800 Subject: FM-1523: Added module summary to metadata.json --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index bf02176..09ad4e8 100644 --- a/metadata.json +++ b/metadata.json @@ -2,7 +2,7 @@ "name": "puppetlabs-stdlib", "version": "4.5.0", "author": "puppetlabs", - "summary": "Puppet Module Standard Library", + "summary": "Standard library of resources for Puppet modules.", "license": "Apache-2.0", "source": "https://github.com/puppetlabs/puppetlabs-stdlib", "project_page": "https://github.com/puppetlabs/puppetlabs-stdlib", -- cgit v1.2.3 From cff764564860e20e39675bac1408b9ed87c07573 Mon Sep 17 00:00:00 2001 From: jbondpdx Date: Tue, 25 Nov 2014 11:32:12 -0800 Subject: Added a note that stdlib no longer ships with PE 3.7+ Users didn't realize we stopped shipping stdlib module with PE. I added this information to the stdlib readme. --- README.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.markdown b/README.markdown index bf953d4..5344002 100644 --- a/README.markdown +++ b/README.markdown @@ -27,6 +27,8 @@ modules. Puppet modules make heavy use of this standard library. The stdlib modu * Defined resource types * Types * Providers + +> *Note:* As of version 3.7, Puppet Enterprise no longer includes the stdlib module. If you're running Puppet Enterprise, you should install the most recent release of stdlib for compatibility with Puppet modules. ##Setup @@ -676,6 +678,8 @@ of the regular expressions match the string passed in, compilation aborts with a ##Limitations +As of Puppet Enterprise version 3.7, the stdlib module is no longer included in PE. PE users should install the most recent release of stdlib for compatibility with Puppet modules. + ###Version Compatibility Versions | Puppet 2.6 | Puppet 2.7 | Puppet 3.x | Puppet 4.x | -- cgit v1.2.3 From 44596dcf3cd7f27ca0dd1d839673923371e0fef2 Mon Sep 17 00:00:00 2001 From: jbondpdx Date: Tue, 16 Dec 2014 14:33:42 -0800 Subject: DOC-1095: edit file_line resource, match parameter Was unclear and not accurate; rewrote the parameter, moved file_line from function list to resource section, added missing parameters for this resource. --- README.markdown | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/README.markdown b/README.markdown index 5344002..3bdb8ed 100644 --- a/README.markdown +++ b/README.markdown @@ -40,7 +40,7 @@ After you've installed stdlib, all of its functions, facts, and resources are av If you want to use a standardized set of run stages for Puppet, `include stdlib` in your manifest. -##Reference +## Reference ### Classes @@ -75,7 +75,30 @@ If you want to use a standardized set of run stages for Puppet, `include stdlib` class { java: stage => 'runtime' } } ``` + +### Resources +* `file_line`: This resource ensures that a given line, including whitespace at the beginning and end, is contained within a file. If the line is not contained in the given file, Puppet will add the line. Multiple resources can be declared to manage multiple lines in the same file. You can also use match to replace existing lines. + + ``` + file_line { 'sudo_rule': + path => '/etc/sudoers', + line => '%sudo ALL=(ALL) ALL', + } + file_line { 'sudo_rule_nopw': + path => '/etc/sudoers', + line => '%sudonopw ALL=(ALL) NOPASSWD: ALL', + } + ``` + + * `after`: Specify the line after which Puppet will add any new lines. (Existing lines are added in place.) Optional. + * `ensure`: Ensures whether the resource is present. Valid values are 'present', 'absent'. + * `line`: The line to be added to the file located by the `path` parameter. + * `match`: A regular expression to run against existing lines in the file; if a match is found, we replace that line rather than adding a new line. Optional. + * `multiple`: Determine if match can change multiple lines. Valid values are 'true', 'false'. Optional. + * `name`: An arbitrary name used as the identity of the resource. + * `path`: The file in which Puppet will ensure the line specified by the line parameter. + ### Functions * `abs`: Returns the absolute value of a number; for example, '-34.56' becomes '34.56'. Takes a single integer and float value as an argument. *Type*: rvalue @@ -158,25 +181,6 @@ also appear in the second array. For example, `difference(["a","b","c"],["b","c" *Type*: statement -* `file_line`: This resource ensures that a given line is contained within a file. You can also use match to replace existing lines. - - *Example:* - - ``` - file_line { 'sudo_rule': - path => '/etc/sudoers', - line => '%sudo ALL=(ALL) ALL', - } - - file_line { 'change_mount': - path => '/etc/fstab', - line => '10.0.0.1:/vol/data /opt/data nfs defaults 0 0', - match => '^172.16.17.2:/vol/old', - } - ``` - - *Type*: resource - * `flatten`: This function flattens any deeply nested arrays and returns a single flat array as a result. For example, `flatten(['a', ['b', ['c']]])` returns ['a','b','c']. *Type*: rvalue * `floor`: Returns the largest integer less than or equal to the argument. -- cgit v1.2.3 From c6c203fca8da81fea96659bfe9618bb31965b837 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 16 Dec 2014 11:48:46 -0800 Subject: Remove line match validation The `match` attribute was validated to match `line`, except that in many cases (even the example given in the docs) a user would want to match a line entirely different from the new line. See comments on the original commit https://github.com/puppetlabs/puppetlabs-stdlib/commit/a06c0d8115892a74666676b50d4282df9850a119 and ask https://ask.puppetlabs.com/question/14366/file_line-resource-match-problems/ for further examples of confusion. --- CHANGELOG.md | 1 + lib/puppet/type/file_line.rb | 7 ------- spec/unit/puppet/type/file_line_spec.rb | 4 ++-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8da04af..c66734e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This release improves functionality of the member function and adds improved fut ####Bugfixes - Fix range() to work with numeric ranges with the future parser - Accurately express SLES support in metadata.json (was missing 10SP4 and 12) +- Don't require `line` to match the `match` parameter ##2014-11-10 - Supported Release 4.4.0 ###Summary diff --git a/lib/puppet/type/file_line.rb b/lib/puppet/type/file_line.rb index 9dbe43c..df263e6 100644 --- a/lib/puppet/type/file_line.rb +++ b/lib/puppet/type/file_line.rb @@ -71,12 +71,5 @@ Puppet::Type.newtype(:file_line) do unless self[:line] and self[:path] raise(Puppet::Error, "Both line and path are required attributes") end - - if (self[:match]) - unless Regexp.new(self[:match]).match(self[:line]) - raise(Puppet::Error, "When providing a 'match' parameter, the value must be a regex that matches against the value of your 'line' parameter") - end - end - end end diff --git a/spec/unit/puppet/type/file_line_spec.rb b/spec/unit/puppet/type/file_line_spec.rb index 9ef49ef..410d0bf 100755 --- a/spec/unit/puppet/type/file_line_spec.rb +++ b/spec/unit/puppet/type/file_line_spec.rb @@ -15,14 +15,14 @@ describe Puppet::Type.type(:file_line) do file_line[:match] = '^foo.*$' expect(file_line[:match]).to eq('^foo.*$') end - it 'should not accept a match regex that does not match the specified line' do + it 'should accept a match regex that does not match the specified line' do expect { Puppet::Type.type(:file_line).new( :name => 'foo', :path => '/my/path', :line => 'foo=bar', :match => '^bar=blah$' - )}.to raise_error(Puppet::Error, /the value must be a regex that matches/) + )}.not_to raise_error end it 'should accept a match regex that does match the specified line' do expect { -- cgit v1.2.3