]> gitweb.fluxo.info Git - puppet-stdlib.git/log
puppet-stdlib.git
13 years agoMerge branch '2.5.x'
Jeff McCune [Thu, 25 Oct 2012 17:47:59 +0000 (10:47 -0700)]
Merge branch '2.5.x'

* 2.5.x:
  Revert "Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x""

13 years agoRevert "Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x""
Jeff McCune [Thu, 25 Oct 2012 17:46:57 +0000 (10:46 -0700)]
Revert "Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x""

This reverts commit d6d23b495cda0e154b4e73982acc43e586564c0e.

This backwards-compatible additional functionality is targeted at the
next minor release.  There are already backwards-incompatible changes in
the master branch so we need to establish a new minor branch.

13 years agoRevert "Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x""
Jeff McCune [Thu, 25 Oct 2012 17:43:51 +0000 (10:43 -0700)]
Revert "Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x""

This reverts commit d6d23b495cda0e154b4e73982acc43e586564c0e.

Why?  Because this change set should actually be in master and our
merge-up process reverted the change set in master when I reverted from
2.4.x.

This patch reverts the revert, restoring the original change set.

13 years agoMerge branch '2.4.x'
Jeff McCune [Thu, 25 Oct 2012 17:43:11 +0000 (10:43 -0700)]
Merge branch '2.4.x'

* 2.4.x:
  Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x"

13 years agoRevert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x"
Jeff McCune [Thu, 25 Oct 2012 17:41:52 +0000 (10:41 -0700)]
Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x"

This reverts commit 74e6411157b8df1af9a24c17971e3236f3096529, reversing
changes made to 417d219aa6e42f2a16af42c98aa063fc1d9d2ecd.

Here's why:

Actually... I just screwed this up.

I merged this new fact into 2.4.x but it's not fixing any bug. It's adding a
new fact, so this should go into master and we should release 2.5 since this is
new, backwards-compatible functionality.

13 years agoMerge branch '2.4.x'
Jeff McCune [Thu, 25 Oct 2012 17:30:14 +0000 (10:30 -0700)]
Merge branch '2.4.x'

* 2.4.x:
  Prevent undefined method `split' for nil:NilClass with pe_foo_version facts
  (maint) Clear all facts before each example
  Add spec tests for pe_version facts
  Add PE facts to stdlib

Conflicts:
spec/spec_helper.rb

13 years agoMerge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x
Jeff McCune [Thu, 25 Oct 2012 17:06:02 +0000 (10:06 -0700)]
Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x

* haus-add_pe_facts_to_stdlib:
  Prevent undefined method `split' for nil:NilClass with pe_foo_version facts
  (maint) Clear all facts before each example
  Add spec tests for pe_version facts
  Add PE facts to stdlib

13 years agoPrevent undefined method `split' for nil:NilClass with pe_foo_version facts
Jeff McCune [Thu, 25 Oct 2012 17:00:42 +0000 (10:00 -0700)]
Prevent undefined method `split' for nil:NilClass with pe_foo_version facts

Without this patch the pe_major_version, pe_minor_version, and
pe_patch_version facts directly depend on the pe_version fact in a
manner that calls split directly on the return value.

This is a problem because Fact values are not always guaranteed to
return strings, or objects that respond to split.  This patch is a
defensive measure to ensure we're always calling the split method on a
string object.

If the Fact returns nil, this will be converted to an empty string
responding to split.

13 years ago(maint) Clear all facts before each example
Jeff McCune [Wed, 24 Oct 2012 23:59:43 +0000 (16:59 -0700)]
(maint) Clear all facts before each example

Without this patch example groups must explicitly call `Facter.clear` to
clear any cached values between examples.  This is a problem because
this behavior is not the concern of the example groups, the behavior is
the concern of the spec_helper or whatever facility we have in place to
initialize the system for testing.

This patch fixes the problem by duplicating the logic in the Facter
spec_helper to ensure facts are cleared out before each example.

This patch requires the example groups to explicitly load the facts they
require if the fact name does not match the filename.

13 years agoAdd spec tests for pe_version facts
Matthaus Owens [Tue, 23 Oct 2012 21:14:06 +0000 (14:14 -0700)]
Add spec tests for pe_version facts

This commit adds some basic spec tests for the pe_version facts. There are
basic postitive and negative cases.

13 years agoAdd PE facts to stdlib
Matthaus Owens [Tue, 23 Oct 2012 21:13:11 +0000 (14:13 -0700)]
Add PE facts to stdlib

As many PE modules have PE specific functionality, but are deployed to all
nodes, including FOSS nodes, it is valuable to be able to selectively enable
those PE specific functions. These facts allow modules to use the is_pe fact to
determine whether the module should be used or not. The facts include is_pe,
pe_version, pe_major_version, pe_minor_version, and pe_patch_version. For PE
2.6.0 those facts would have values true, 2.6.0, 2, 6, and 0, respectively.

13 years agoMerge branch '3.x'
Jeff McCune [Thu, 30 Aug 2012 21:57:55 +0000 (14:57 -0700)]
Merge branch '3.x'

* 3.x:
  (Maint) Remove core function documentation from README

Conflicts:
README.markdown

13 years agoMerge branch '3.0.x' into 3.x
Jeff McCune [Thu, 30 Aug 2012 21:57:00 +0000 (14:57 -0700)]
Merge branch '3.0.x' into 3.x

* 3.0.x:
  (Maint) Remove core function documentation from README

13 years agoMerge branch 'bug/3.0.x/remove_core_function_docs' into 3.0.x
Jeff McCune [Thu, 30 Aug 2012 21:54:52 +0000 (14:54 -0700)]
Merge branch 'bug/3.0.x/remove_core_function_docs' into 3.0.x

* bug/3.0.x/remove_core_function_docs:
  (Maint) Remove core function documentation from README

13 years ago(Maint) Remove core function documentation from README
Jeff McCune [Thu, 30 Aug 2012 21:50:00 +0000 (14:50 -0700)]
(Maint) Remove core function documentation from README

Without this patch the README contains the documentation for core
functions shipped in Puppet in addition to the functions shipped in
stdlib.

This is a problem because it's confusing for end users trying to get
started with puppet.

This patch makes it so only the stdlib functions are included.

13 years agoMerge pull request #93 from ptman/patch-1
Jeff McCune [Thu, 30 Aug 2012 16:40:56 +0000 (09:40 -0700)]
Merge pull request #93 from ptman/patch-1

Fix some logical inconsistencies in README

13 years agoFix some logical inconsistencies in README
Paul Tötterman [Thu, 30 Aug 2012 10:40:12 +0000 (13:40 +0300)]
Fix some logical inconsistencies in README

13 years agoMerge branch '3.x'
Jeff McCune [Mon, 20 Aug 2012 21:25:17 +0000 (14:25 -0700)]
Merge branch '3.x'

* 3.x:
  Disable tests that fail on 2.6.x due to #15912

13 years agoMerge branch '3.0.x' into 3.x
Jeff McCune [Mon, 20 Aug 2012 21:25:06 +0000 (14:25 -0700)]
Merge branch '3.0.x' into 3.x

* 3.0.x:
  Disable tests that fail on 2.6.x due to #15912

13 years agoMerge branch '2.4.x' into 3.0.x
Jeff McCune [Mon, 20 Aug 2012 21:24:52 +0000 (14:24 -0700)]
Merge branch '2.4.x' into 3.0.x

* 2.4.x:
  Disable tests that fail on 2.6.x due to #15912

13 years agoMerge branch '2.3.x' into 2.4.x
Jeff McCune [Mon, 20 Aug 2012 21:24:41 +0000 (14:24 -0700)]
Merge branch '2.3.x' into 2.4.x

* 2.3.x:
  Disable tests that fail on 2.6.x due to #15912

13 years agoMerge branch '2.2.x' into 2.3.x
Jeff McCune [Mon, 20 Aug 2012 21:24:23 +0000 (14:24 -0700)]
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  Disable tests that fail on 2.6.x due to #15912

13 years agoMerge branch '2.1.x' into 2.2.x
Jeff McCune [Mon, 20 Aug 2012 21:24:08 +0000 (14:24 -0700)]
Merge branch '2.1.x' into 2.2.x

* 2.1.x:
  Disable tests that fail on 2.6.x due to #15912

Conflicts:
spec/unit/puppet/parser/functions/getvar_spec.rb
spec/unit/puppet/parser/functions/has_key_spec.rb
spec/unit/puppet/parser/functions/merge_spec.rb

13 years agoMerge branch 'fix/2.1.x/disable_puppet26_failing_tests' into 2.1.x
Jeff McCune [Mon, 20 Aug 2012 21:22:40 +0000 (14:22 -0700)]
Merge branch 'fix/2.1.x/disable_puppet26_failing_tests' into 2.1.x

* fix/2.1.x/disable_puppet26_failing_tests:
  Disable tests that fail on 2.6.x due to #15912

13 years agoDisable tests that fail on 2.6.x due to #15912
Jeff McCune [Mon, 20 Aug 2012 21:21:12 +0000 (14:21 -0700)]
Disable tests that fail on 2.6.x due to #15912

In Puppet 2.6.x there is a bug where a function may be incorrectly detected as
an rvalue when it is not, or not detected when it is. This means that in tests
the correct syntax for calling a function will be rejected. This disables
those tests on 2.6.x, as there is no straightforward way to write them to be
compatible with both 2.6.x and newer versions of Puppet.

Conflicts:
spec/unit/puppet/parser/functions/getvar_spec.rb
spec/unit/puppet/parser/functions/has_key_spec.rb
spec/unit/puppet/parser/functions/merge_spec.rb

This patch was constructed by cherry-picking e27eccb and resolving the
merge conflicts to only include the `pending` statements.  This resolves
the problem by disabling these tests in Puppet 2.6.

13 years agoMerge branch '3.x'
Jeff McCune [Mon, 20 Aug 2012 21:05:42 +0000 (14:05 -0700)]
Merge branch '3.x'

* 3.x:
  (Maint) Fix mis-use of rvalue functions as statements
  Add .rspec file to repo root

13 years agoMerge branch '3.0.x' into 3.x
Jeff McCune [Mon, 20 Aug 2012 21:05:35 +0000 (14:05 -0700)]
Merge branch '3.0.x' into 3.x

* 3.0.x:
  (Maint) Fix mis-use of rvalue functions as statements
  Add .rspec file to repo root

13 years agoMerge branch '2.4.x' into 3.0.x
Jeff McCune [Mon, 20 Aug 2012 21:05:16 +0000 (14:05 -0700)]
Merge branch '2.4.x' into 3.0.x

* 2.4.x:
  (Maint) Fix mis-use of rvalue functions as statements
  Add .rspec file to repo root

13 years agoMerge branch '2.3.x' into 2.4.x
Jeff McCune [Mon, 20 Aug 2012 21:04:15 +0000 (14:04 -0700)]
Merge branch '2.3.x' into 2.4.x

* 2.3.x:
  (Maint) Fix mis-use of rvalue functions as statements
  Add .rspec file to repo root

13 years agoMerge branch '2.2.x' into 2.3.x
Jeff McCune [Mon, 20 Aug 2012 21:04:03 +0000 (14:04 -0700)]
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  (Maint) Fix mis-use of rvalue functions as statements
  Add .rspec file to repo root

13 years agoMerge branch '2.1.x' into 2.2.x
Jeff McCune [Mon, 20 Aug 2012 21:03:48 +0000 (14:03 -0700)]
Merge branch '2.1.x' into 2.2.x

* 2.1.x:
  (Maint) Fix mis-use of rvalue functions as statements
  Add .rspec file to repo root

Conflicts:
spec/unit/puppet/parser/functions/getvar_spec.rb
spec/unit/puppet/parser/functions/has_key_spec.rb
spec/unit/puppet/parser/functions/merge_spec.rb

13 years agoMerge branch 'fix/2.1.x/spec_failures' into 2.1.x
Jeff McCune [Mon, 20 Aug 2012 21:01:56 +0000 (14:01 -0700)]
Merge branch 'fix/2.1.x/spec_failures' into 2.1.x

* fix/2.1.x/spec_failures:
  (Maint) Fix mis-use of rvalue functions as statements
  Add .rspec file to repo root

13 years ago(Maint) Fix mis-use of rvalue functions as statements
Jeff McCune [Mon, 20 Aug 2012 20:57:09 +0000 (13:57 -0700)]
(Maint) Fix mis-use of rvalue functions as statements

Without this patch applied the spec tests are invalid because they call
rvalue functions as if they were statements.  This is a problem because
Puppet 2.7.x currently throws an exception if a rvalue function is
invoked as if it were a statement function.  This exception from Puppet
is causing tests to fail.

This patch fixes the problem by changing the tests to assign the return
value of the functions to a variable.  This fixes the problem by
invoking the functions properly.

Paired-with: Andrew Parker <andy@puppetlabs.com>

13 years agoAdd .rspec file to repo root
Jeff McCune [Mon, 20 Aug 2012 18:49:45 +0000 (11:49 -0700)]
Add .rspec file to repo root

Without this patch we don't get an opinionated rspec behavior.  This
patch makes the behavior of `rake test` and `rspec spec/` opinionated
by including some default options.

13 years agoMerge branch '3.x'
Jeff McCune [Sun, 19 Aug 2012 23:29:22 +0000 (16:29 -0700)]
Merge branch '3.x'

* 3.x:
  (#14422) Update README to include the bug tracker URL.

13 years agoMerge branch '3.0.x' into 3.x
Jeff McCune [Sun, 19 Aug 2012 23:29:09 +0000 (16:29 -0700)]
Merge branch '3.0.x' into 3.x

* 3.0.x:
  (#14422) Update README to include the bug tracker URL.

13 years agoMerge branch 'fix/3.0.x/14422_readme' into 3.0.x
Jeff McCune [Sun, 19 Aug 2012 23:28:59 +0000 (16:28 -0700)]
Merge branch 'fix/3.0.x/14422_readme' into 3.0.x

* fix/3.0.x/14422_readme:
  (#14422) Update README to include the bug tracker URL.

13 years ago(#14422) Update README to include the bug tracker URL.
Eric Sorenson [Fri, 17 Aug 2012 22:15:26 +0000 (15:15 -0700)]
(#14422) Update README to include the bug tracker URL.

As reported, it is indeed difficult to navigate directly to the correct
part of Redmine for a particular sub-project. This commit puts the
issue tracker URL front and center.

13 years agoMerge pull request #90 from ahpook/14422_update_readme
Jeff McCune [Sun, 19 Aug 2012 23:24:59 +0000 (16:24 -0700)]
Merge pull request #90 from ahpook/14422_update_readme

(#14422) Update README to include the bug tracker URL.

13 years ago(#14422) Update README to include the bug tracker URL.
Eric Sorenson [Fri, 17 Aug 2012 22:15:26 +0000 (15:15 -0700)]
(#14422) Update README to include the bug tracker URL.

As reported, it is indeed difficult to navigate directly to the correct
part of Redmine for a particular sub-project. This commit puts the
issue tracker URL front and center.

13 years agoRevert "Revert "Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'""
Jeff McCune [Fri, 17 Aug 2012 02:49:47 +0000 (19:49 -0700)]
Revert "Revert "Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'""

This reverts commit d3e30bcdc64964bba82e05e5409c38faa7f2b700.

13 years agoUpdate CHANGELOG, Modulefile for 3.0.1
Jeff McCune [Fri, 17 Aug 2012 02:47:32 +0000 (19:47 -0700)]
Update CHANGELOG, Modulefile for 3.0.1

13 years agoMerge branch 'fix/master/where_did_facts_dot_d_go'
Jeff McCune [Fri, 17 Aug 2012 02:42:28 +0000 (19:42 -0700)]
Merge branch 'fix/master/where_did_facts_dot_d_go'

* fix/master/where_did_facts_dot_d_go:
  Revert "Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'"

13 years agoRevert "Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'"
Jeff McCune [Fri, 17 Aug 2012 02:28:13 +0000 (19:28 -0700)]
Revert "Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'"

This reverts commit cc414a422de0d773a1012ca57f41f15b4d6caf06, reversing
changes made to 29f8f89c19b2189aa78ab430e94671669cb4716c.

Conflicts:
README.markdown

Without this patch, there is no facts_dot_d functionality and we don't
have it implemented in Facter 2.0.  This is a problem because Puppet
Enterprise and many users rely on facts.d support.  We're also backwards
compatible with Facter 1.6 in stdlib 3.0 so this is a bug fix.

13 years agoMerge branch 'release/master/three_dot_oh_dot_oh'
Jeff McCune [Thu, 16 Aug 2012 18:02:55 +0000 (11:02 -0700)]
Merge branch 'release/master/three_dot_oh_dot_oh'

* release/master/three_dot_oh_dot_oh:
  Update CHANGELOG, Modulefile for 3.0.0
  (Maint) Update README for 3.0.0

13 years agoUpdate CHANGELOG, Modulefile for 3.0.0
Jeff McCune [Thu, 16 Aug 2012 18:01:09 +0000 (11:01 -0700)]
Update CHANGELOG, Modulefile for 3.0.0

13 years ago(Maint) Update README for 3.0.0
Jeff McCune [Thu, 16 Aug 2012 17:59:31 +0000 (10:59 -0700)]
(Maint) Update README for 3.0.0

This commit updates the README for 3.0.0 by taking a function list
produced with `puppet doc -r function` _without_ stdlib in the
`$LOAD_PATH` and then filtering out the native functions by executing
`puppet doc -r function` _with_ stdlib/lib in the `$LOAD_PATH` and then
running `comm -13 core_functions.txt all_functions.txt`

13 years agoMerge branch 'bodepd-ensure_resource_attempt_2'
Jeff McCune [Thu, 16 Aug 2012 17:41:23 +0000 (10:41 -0700)]
Merge branch 'bodepd-ensure_resource_attempt_2'

* bodepd-ensure_resource_attempt_2:
  Explicitly load functions used by ensure_resource
  Revert "Revert "Merge pull request #86 from bodepd/ensure_resource""

13 years agoExplicitly load functions used by ensure_resource
Dan Bode [Wed, 15 Aug 2012 22:57:45 +0000 (15:57 -0700)]
Explicitly load functions used by ensure_resource

The ensure_resource function actually calls two
other functions, create_resources and defined_with_param.

When calling Puppet functions from Ruby, you sometimes have
to load the functions manually if they have not been called
before.

This commit explicitly loads the functions that ensure_resource
depends on from within the function.

13 years agoRevert "Revert "Merge pull request #86 from bodepd/ensure_resource""
Dan Bode [Wed, 15 Aug 2012 22:56:57 +0000 (15:56 -0700)]
Revert "Revert "Merge pull request #86 from bodepd/ensure_resource""

This reverts commit 1e0983362464e8f2832239b09cdbc9175a51e6ec.

13 years agoRevert "Merge pull request #86 from bodepd/ensure_resource"
Jeff McCune [Wed, 15 Aug 2012 01:26:17 +0000 (18:26 -0700)]
Revert "Merge pull request #86 from bodepd/ensure_resource"

This reverts commit 42ddd7fe54f37b84e34b4a005de2249e53f07469, reversing
changes made to 53243605b28fc31618d079155c86b37b4e88a6ca.

13 years agoMerge pull request #86 from bodepd/ensure_resource
Jeff McCune [Wed, 15 Aug 2012 01:11:15 +0000 (18:11 -0700)]
Merge pull request #86 from bodepd/ensure_resource

Add function ensure_resource and defined_with_params

13 years agoMerge branch '2.4.x'
Jeff McCune [Tue, 14 Aug 2012 22:08:13 +0000 (15:08 -0700)]
Merge branch '2.4.x'

* 2.4.x:
  Update Modulefile, CHANGELOG for 2.4.0

13 years agoUpdate Modulefile, CHANGELOG for 2.4.0
Jeff McCune [Tue, 14 Aug 2012 17:18:42 +0000 (10:18 -0700)]
Update Modulefile, CHANGELOG for 2.4.0

13 years agoMerge branch '2.4.x'
Jeff McCune [Tue, 14 Aug 2012 17:09:26 +0000 (10:09 -0700)]
Merge branch '2.4.x'

* 2.4.x:
  Add support for a 'match' parameter to file_line

13 years agoMerge branch 'feature/2.4.x/backport_file_line_match_pr75' into 2.4.x
Jeff McCune [Tue, 14 Aug 2012 17:08:41 +0000 (10:08 -0700)]
Merge branch 'feature/2.4.x/backport_file_line_match_pr75' into 2.4.x

* feature/2.4.x/backport_file_line_match_pr75:
  Add support for a 'match' parameter to file_line

13 years agoAdd support for a 'match' parameter to file_line
Chris Price [Thu, 7 Jun 2012 16:09:14 +0000 (09:09 -0700)]
Add support for a 'match' parameter to file_line

This commit adds a new parameter called "match"
to the file_line resource type, and support for
this new parameter to the corresponding ruby
provider.

This parameter is optional; file_line should work
just as before if you do not specify this parameter...
so this change should be backwards-compatible.

If you do specify the parameter, it is treated
as a regular expression that should be used when
looking through the file for a line.  This allows
you to do things like find a line that begins with
a certain prefix (e.g., "foo=.*"), and *replace*
the existing line with the line you specify in your
"line" parameter.  Without this capability, if you
already had a line "foo=bar" in your file and your
"line" parameter was set to "foo=baz", you'd end up
with *both* lines in the final file.  In many cases
this is undesirable.

13 years agoMerge branch '2.4.x'
Jeff McCune [Tue, 14 Aug 2012 15:48:25 +0000 (08:48 -0700)]
Merge branch '2.4.x'

* 2.4.x:
  (#15872) Add to_bytes function

13 years agoMerge branch 'feature/2.4.x/to_bytes_function' into 2.4.x
Jeff McCune [Tue, 14 Aug 2012 15:47:41 +0000 (08:47 -0700)]
Merge branch 'feature/2.4.x/to_bytes_function' into 2.4.x

* feature/2.4.x/to_bytes_function:
  (#15872) Add to_bytes function

13 years ago(#15872) Add to_bytes function
Erik Dalén [Tue, 7 Aug 2012 21:36:20 +0000 (23:36 +0200)]
(#15872) Add to_bytes function

Converts a string like "2 MB" to the value in bytes. Useful for
comparisons on facts that return a human readable number instead of
machine readable.

13 years agore-formatting
Dan Bode [Tue, 14 Aug 2012 01:53:47 +0000 (18:53 -0700)]
re-formatting

This commit refactors to ensure 80 character lines.

13 years agoAdd better docs about duplicate resource failures
Dan Bode [Tue, 14 Aug 2012 01:52:56 +0000 (18:52 -0700)]
Add better docs about duplicate resource failures

This commit adds better inline documentation
explaining how replicate resource definitions can
occur if the resource exists and does not have
matching parameters.

13 years agoHandle undef for parameter argument
Dan Bode [Tue, 14 Aug 2012 01:52:00 +0000 (18:52 -0700)]
Handle undef for parameter argument

This commit adds better handling of the case where
undef is passed as the parameter value.

This works by converting '' into []

13 years agoAdd function ensure_resource and defined_with_params
Dan Bode [Wed, 8 Aug 2012 03:48:54 +0000 (20:48 -0700)]
Add function ensure_resource and defined_with_params

This commit adds 2 new functions with unit tests.

defined_with_params works similarily to puppet's defined
function, except it allows you to also specify a hash of
params. defined_with_params will return true if a resource
also exists that matches the specified type/title (just like
with defined) as well as all of the specified params.

ensure_resource is a function that basically combines defined_with_params
with create_resources to conditionally create resources only if the
specified resource (title, type, params) does not already exist.

These functions are created to serve as an alternative to using
defined as follows:

    if ! defined(Package['some_package']) {
      package { 'some_package': ensure => present,
    }

The issue with this usage is that there is no guarentee about
what parameters were set in the previous definition of the package
that made its way into the catalog.

ensure_resource could be used instead, as:

    ensure_resource('package', 'some_package', { 'ensure' => 'present' })

This will creat the package resources only if another resource does
not exist with the specified parameters.

13 years agoMerge branch '2.4.x'
Patrick Carlisle [Fri, 10 Aug 2012 18:55:24 +0000 (11:55 -0700)]
Merge branch '2.4.x'

* 2.4.x:
  (Maint) use PuppetlabsSpec::PuppetInternals.scope (master)
  Disable tests that fail on 2.6.x due to #15912

13 years ago(Maint) use PuppetlabsSpec::PuppetInternals.scope (master)
Jeff McCune [Thu, 19 Jul 2012 23:14:37 +0000 (16:14 -0700)]
(Maint) use PuppetlabsSpec::PuppetInternals.scope (master)

This patch is the same approach as the one that want into 2.3.x.  It
covers the functions in master that do not exist in 2.3.x.

Without this patch all of the spec tests for parser functions in stdlib
would instantiate their own scope instances.  This is a problem because
the standard library is tightly coupled with the internal behavior of
Puppet.  Tight coupling like this creates failures when we change the
internal behavior of Puppet.  This is exactly what happened recently
when we changed the method signature for the initializer of
Puppet::Parser::Scope instances.

This patch fixes the problem by creating scope instances using the
puppet labs spec helper.  The specific method that provides scope
instances in Puppet-version-independent way is something like this:

    let(:scope) { PuppetlabsSpec::PuppetInternals.scope }

This patch simply implements this across the board.

Paired-with: Andrew Parker <andy@puppetlabs.com>

13 years agoMerge branch '2.3.x' into 2.4.x
Patrick Carlisle [Fri, 10 Aug 2012 18:52:40 +0000 (11:52 -0700)]
Merge branch '2.3.x' into 2.4.x

* 2.3.x:
  Disable tests that fail on 2.6.x due to #15912

13 years agoMerge branch '2.2.x' into 2.3.x
Patrick Carlisle [Fri, 10 Aug 2012 18:52:03 +0000 (11:52 -0700)]
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  Disable tests that fail on 2.6.x due to #15912

13 years agoDisable tests that fail on 2.6.x due to #15912
Patrick Carlisle [Fri, 10 Aug 2012 18:43:36 +0000 (11:43 -0700)]
Disable tests that fail on 2.6.x due to #15912

In Puppet 2.6.x there is a bug where a function may be incorrectly detected as
an rvalue when it is not, or not detected when it is. This means that in tests
the correct syntax for calling a function will be rejected. This disables
those tests on 2.6.x, as there is no straightforward way to write them to be
compatible with both 2.6.x and newer versions of Puppet.

13 years agoMerge branch '2.4.x'
Patrick Carlisle [Thu, 9 Aug 2012 22:22:13 +0000 (15:22 -0700)]
Merge branch '2.4.x'

* 2.4.x:
  Make sure functions are loaded for each test
  Use rvalue functions correctly
  (#2157) Make facts_dot_d compatible with external facts

Conflicts:
lib/facter/facter_dot_d.rb

13 years agoMerge branch '2.3.x' into 2.4.x
Patrick Carlisle [Thu, 9 Aug 2012 21:52:08 +0000 (14:52 -0700)]
Merge branch '2.3.x' into 2.4.x

* 2.3.x:
  Make sure functions are loaded for each test
  Use rvalue functions correctly
  (Maint) Don't mock with mocha
  (Maint) Fix up the get_module_path parser function
  (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope (2.3.x)
  (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals}
  (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope
  (Maint) Fix interpreter lines
  Update CHANGELOG, Modulefile for 2.3.3
  fix regression in #11017 properly
  Fix spec tests using the new spec_helper
  Update CHANGELOG for 2.3.2 release
  Make file_line default to ensure => present
  Memoize file_line spec instance variables
  Fix spec tests using the new spec_helper
  Revert "Merge remote-tracking branch 'eshamow/tickets/bug/13595_restrict_initialize_everything_for_tests' into 2.2.x"
  (#13595) initialize_everything_for_tests couples modules Puppet ver

13 years agoMake sure functions are loaded for each test
Patrick Carlisle [Thu, 9 Aug 2012 21:33:10 +0000 (14:33 -0700)]
Make sure functions are loaded for each test

The test_helper code in Puppet now resets function state between each test.
This patch fixes two spec files where the function was not actually loaded in
the tests, causing them to fail.

13 years agoMerge branch '2.2.x' into 2.3.x
Patrick Carlisle [Thu, 9 Aug 2012 21:51:33 +0000 (14:51 -0700)]
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  Use rvalue functions correctly

13 years agoUse rvalue functions correctly
Patrick Carlisle [Thu, 9 Aug 2012 21:18:30 +0000 (14:18 -0700)]
Use rvalue functions correctly

A bug fix in Puppet exposed that several tests were using rvalue functions
incorrectly (this was not properly checked by puppet before). This fixes those
tests.

13 years agoMerge branch 'fix/master/fix_scope_dependency'
Jeff McCune [Mon, 23 Jul 2012 23:11:08 +0000 (16:11 -0700)]
Merge branch 'fix/master/fix_scope_dependency'

* fix/master/fix_scope_dependency:
  (Maint) use PuppetlabsSpec::PuppetInternals.scope (master)

13 years ago(Maint) use PuppetlabsSpec::PuppetInternals.scope (master)
Jeff McCune [Thu, 19 Jul 2012 23:14:37 +0000 (16:14 -0700)]
(Maint) use PuppetlabsSpec::PuppetInternals.scope (master)

This patch is the same approach as the one that want into 2.3.x.  It
covers the functions in master that do not exist in 2.3.x.

Without this patch all of the spec tests for parser functions in stdlib
would instantiate their own scope instances.  This is a problem because
the standard library is tightly coupled with the internal behavior of
Puppet.  Tight coupling like this creates failures when we change the
internal behavior of Puppet.  This is exactly what happened recently
when we changed the method signature for the initializer of
Puppet::Parser::Scope instances.

This patch fixes the problem by creating scope instances using the
puppet labs spec helper.  The specific method that provides scope
instances in Puppet-version-independent way is something like this:

    let(:scope) { PuppetlabsSpec::PuppetInternals.scope }

This patch simply implements this across the board.

Paired-with: Andrew Parker <andy@puppetlabs.com>

13 years agoMerge branch '2.3.x'
Jeff McCune [Mon, 23 Jul 2012 22:59:52 +0000 (15:59 -0700)]
Merge branch '2.3.x'

* 2.3.x:
  (Maint) Don't mock with mocha
  (Maint) Fix up the get_module_path parser function
  (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope (2.3.x)
  (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals}
  (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope
  (Maint) Fix interpreter lines

Conflicts:
spec/spec_helper.rb
spec/unit/puppet/parser/functions/get_module_path_spec.rb

13 years agoMerge branch 'maint/2.3.x/fix_rspec_puppet_load_order_issue' into 2.3.x
Jeff McCune [Mon, 23 Jul 2012 22:55:08 +0000 (15:55 -0700)]
Merge branch 'maint/2.3.x/fix_rspec_puppet_load_order_issue' into 2.3.x

* maint/2.3.x/fix_rspec_puppet_load_order_issue:
  (Maint) Don't mock with mocha

13 years ago(Maint) Don't mock with mocha
Jeff McCune [Mon, 23 Jul 2012 22:47:51 +0000 (15:47 -0700)]
(Maint) Don't mock with mocha

Without this patch applied the stdlib module has load-order issues with mocha
and rspec-puppet.  The root cause has yet to be determined, but we've narrowed
it down to this description:

  "If any rspec-puppet example groups run before parser function example groups
   and the parser function example groups use mock() then you'll get this error:"

You can exercise this explicitly with:

    rspec -fd spec/unit/puppet/{provider,type,parser}

This will ensure rspec runs all of the provider and type spec tests, which are
rspec-puppet ones, before the parser function specs are run.  I should also
note we empted out the test in the file_line provider to be nothing except an
empty describe block and this was still sufficient to trigger the load order
error described here.

    Failures:

      1) function_get_module_path when locating a module should be able to find module paths from the modulepath setting
         Failure/Error: mod = mock("Puppet::Module")
         NoMethodError:
           undefined method `mock' for #<RSpec::Core::ExampleGroup::Nested_14::Nested_1:0x107b946c0>
         # ./spec/unit/puppet/parser/functions/get_module_path_spec.rb:21
         # ./spec/unit/puppet/parser/functions/get_module_path_spec.rb:29

      2) function_get_module_path when locating a module should be able to find module paths when the modulepath is a list
         Failure/Error: mod = mock("Puppet::Module")
         NoMethodError:
           undefined method `mock' for #<RSpec::Core::ExampleGroup::Nested_14::Nested_1:0x107b81ea8>
         # ./spec/unit/puppet/parser/functions/get_module_path_spec.rb:21
         # ./spec/unit/puppet/parser/functions/get_module_path_spec.rb:34

      3) function_get_module_path when locating a module should respect the environment
         Failure/Error: mod = mock("Puppet::Module")
         NoMethodError:
           undefined method `mock' for #<RSpec::Core::ExampleGroup::Nested_14::Nested_1:0x107b6e808>
         # ./spec/unit/puppet/parser/functions/get_module_path_spec.rb:21
         # ./spec/unit/puppet/parser/functions/get_module_path_spec.rb:40

    Finished in 1.53 seconds
    326 examples, 3 failures, 1 pending

Paired-with: Andrew Parker <andy@puppetlabs.com>

13 years agoMerge pull request #80 from jeffmccune/fix/2.3.x/go_green
Jeff McCune [Mon, 23 Jul 2012 16:25:34 +0000 (09:25 -0700)]
Merge pull request #80 from jeffmccune/fix/2.3.x/go_green

Fix up 2.3.x for new scope

13 years ago(Maint) Fix up the get_module_path parser function
Jeff McCune [Fri, 20 Jul 2012 00:37:39 +0000 (17:37 -0700)]
(Maint) Fix up the get_module_path parser function

This patch switches the spec tests for the get_module_path function to
use mock objects.  The underlying Puppet::Module.find method has
reasonable test coverage inside of Puppet core so we might as well break
the tight dependency while we're fixing up the specs to use the new
parser scope.

The behavior of the parser function itself should still have complete
coverage even though the tests have switched to mock the implementation
inside of Puppet.

13 years ago(Maint) use PuppetlabsSpec::PuppetSeams.parser_scope (2.3.x)
Jeff McCune [Thu, 19 Jul 2012 23:14:37 +0000 (16:14 -0700)]
(Maint) use PuppetlabsSpec::PuppetSeams.parser_scope (2.3.x)

This patch is the same approach as the one that want into 2.2.x.  It
covers the functions in 2.3.x that do not exist in 2.2.x.

Without this patch all of the spec tests for parser functions in stdlib
would instantiate their own scope instances.  This is a problem because
the standard library is tightly coupled with the internal behavior of
Puppet.  Tight coupling like this creates failures when we change the
internal behavior of Puppet.  This is exactly what happened recently
when we changed the method signature for the initializer of
Puppet::Parser::Scope instances.

This patch fixes the problem by creating scope instances using the
puppet labs spec helper.  The specific method that provides scope
instances in Puppet-version-independent way is something like this:

    let(:scope) { PuppetlabsSpec::PuppetInternals.scope }

This patch simply implements this across the board.

13 years agoMerge branch '2.2.x' into maint/2.3.x/merge_up_2.2.x
Jeff McCune [Mon, 23 Jul 2012 16:00:11 +0000 (09:00 -0700)]
Merge branch '2.2.x' into maint/2.3.x/merge_up_2.2.x

* 2.2.x:
  (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals}
  (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope
  (Maint) Fix interpreter lines

13 years agoMerge pull request #81 from jeffmccune/maint/2.2.x/rename_seams_to_internals
Jeff McCune [Mon, 23 Jul 2012 15:51:13 +0000 (08:51 -0700)]
Merge pull request #81 from jeffmccune/maint/2.2.x/rename_seams_to_internals

(Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals}

13 years ago(Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals}
Jeff McCune [Mon, 23 Jul 2012 15:28:06 +0000 (08:28 -0700)]
(Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals}

The module PuppetlabsSpec::PuppetSeams has been renamed in the
puppetlabs_spec_helper gem to PuppetlabsSpec::PuppetInternals.

The method to obtain a scope object has also changed slightly.  Without
this patch the spec tests will fail because the stdlib module is not
aligned with the spec helper gem.  This patch fixes the problem by
matching up messages with their receivers in the spec helper library.

Paired-with: Andrew Parker <andy@puppetlabs.com>

13 years agoMerge branch 'fix/2.2.x/make_it_green' into 2.2.x
Jeff McCune [Thu, 19 Jul 2012 23:36:26 +0000 (16:36 -0700)]
Merge branch 'fix/2.2.x/make_it_green' into 2.2.x

* fix/2.2.x/make_it_green:
  (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope
  (Maint) Fix interpreter lines

13 years ago(Maint) use PuppetlabsSpec::PuppetSeams.parser_scope
Jeff McCune [Thu, 19 Jul 2012 23:14:37 +0000 (16:14 -0700)]
(Maint) use PuppetlabsSpec::PuppetSeams.parser_scope

Without this patch all of the spec tests for parser functions in stdlib
would instantiate their own scope instances.  This is a problem because
the standard library is tightly coupled with the internal behavior of
Puppet.  Tight coupling like this creates failures when we change the
internal behavior of Puppet.  This is exactly what happened recently
when we changed the method signature for the initializer of
Puppet::Parser::Scope instances.

This patch fixes the problem by creating scope instances using the
puppet labs spec helper.  The specific method that provides scope
instances in Puppet-version-independent way is something like this:

 let(:scope) { PuppetlabsSpec::PuppetSeams.parser_scope }

This patch simply implements this across the board.

13 years ago(Maint) Fix interpreter lines
Jeff McCune [Thu, 19 Jul 2012 22:27:52 +0000 (15:27 -0700)]
(Maint) Fix interpreter lines

This time around I actually know why I'm doing this thanks to the
reminder from Nick Lewis.

Ruby will replace itself in memory with the executable listed in the
interpreter line if the string "ruby" is not in there.

Since /usr/bin/env rspec doesn't contain the substring "ruby", you can't
actually run ruby -W1 or whatever on the file.

This patch fixes the problem by making sure "ruby" is present,
preventing ruby from replacing itself in memory.

13 years agoMerge pull request #77 from hkenney/ticket/2.4.x/2157_add_external_fact_compatibility
Jeff McCune [Fri, 13 Jul 2012 01:07:50 +0000 (18:07 -0700)]
Merge pull request #77 from hkenney/ticket/2.4.x/2157_add_external_fact_compatibility

(#2157) Make facts_dot_d compatible with external facts

13 years agoMerge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'
Jeff McCune [Fri, 13 Jul 2012 01:03:59 +0000 (18:03 -0700)]
Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'

* hkenney-ticket/master/2157_remove_facts_dot_d:
  (#2157) Update README about facts_dot_d
  (#2157) Remove facter_dot_d for compatibility with external facts

13 years ago(#2157) Update README about facts_dot_d
Jeff McCune [Fri, 13 Jul 2012 00:51:55 +0000 (17:51 -0700)]
(#2157) Update README about facts_dot_d

13 years ago(#2157) Make facts_dot_d compatible with external facts
Hailee Kenney [Tue, 10 Jul 2012 22:24:33 +0000 (15:24 -0700)]
(#2157) Make facts_dot_d compatible with external facts

Since facts_dot_d will eventually be removed and replaced by
external facts, warn users who are using a ttl on their external
facts that this feature will not be in Facter external facts.

Provide a link to a page explaining how to cache fact values
without the ttl functionality.

13 years ago(#2157) Remove facter_dot_d for compatibility with external facts
Hailee Kenney [Tue, 10 Jul 2012 19:00:31 +0000 (12:00 -0700)]
(#2157) Remove facter_dot_d for compatibility with external facts

Since external facts does the same thing as facts_dot_d (except
allow ttl for external facts and allow some Windows executable
external facts), and external facts is the prefered solution,
remove facts_dot_d in the next major relase of stdlib.

13 years agoMerge pull request #73 from branan/use_spechelper_gem
Chris Price [Wed, 27 Jun 2012 00:44:39 +0000 (17:44 -0700)]
Merge pull request #73 from branan/use_spechelper_gem

Update for new gem version of puppetlabs_spec_helper

13 years agoMerge pull request #75 from cprice-puppet/feature/master/regex-support-for-file-line
Jeff McCune [Mon, 11 Jun 2012 06:28:13 +0000 (23:28 -0700)]
Merge pull request #75 from cprice-puppet/feature/master/regex-support-for-file-line

Add support for a 'match' parameter to file_line

13 years agoAdd support for a 'match' parameter to file_line
Chris Price [Thu, 7 Jun 2012 16:09:14 +0000 (09:09 -0700)]
Add support for a 'match' parameter to file_line

This commit adds a new parameter called "match"
to the file_line resource type, and support for
this new parameter to the corresponding ruby
provider.

This parameter is optional; file_line should work
just as before if you do not specify this parameter...
so this change should be backwards-compatible.

If you do specify the parameter, it is treated
as a regular expression that should be used when
looking through the file for a line.  This allows
you to do things like find a line that begins with
a certain prefix (e.g., "foo=.*"), and *replace*
the existing line with the line you specify in your
"line" parameter.  Without this capability, if you
already had a line "foo=bar" in your file and your
"line" parameter was set to "foo=baz", you'd end up
with *both* lines in the final file.  In many cases
this is undesirable.

13 years agoRequire the new puppetlabs_spec_helper gem name
Branan Purvine-Riley [Wed, 30 May 2012 00:53:27 +0000 (17:53 -0700)]
Require the new puppetlabs_spec_helper gem name

13 years agoUpdate for new gem version of puppetlabs_spec_helper
Branan Purvine-Riley [Tue, 29 May 2012 20:55:26 +0000 (13:55 -0700)]
Update for new gem version of puppetlabs_spec_helper

This updates the Rakefile and spec_helper to use the common versions
available in the puppetlabs_spec_helper rubygem branch. This mostly
just removes a bunch of duplicated code, but it also gives us more
flexibility in how the module is tested in the future.

13 years agoMerge branch '2.3.x'
Jeff McCune [Wed, 23 May 2012 17:56:05 +0000 (10:56 -0700)]
Merge branch '2.3.x'

* 2.3.x:
  Update CHANGELOG, Modulefile for 2.3.3

13 years agoUpdate CHANGELOG, Modulefile for 2.3.3
Jeff McCune [Wed, 23 May 2012 17:52:41 +0000 (10:52 -0700)]
Update CHANGELOG, Modulefile for 2.3.3