]> gitweb.fluxo.info Git - puppet-stdlib.git/log
puppet-stdlib.git
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 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

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

* 2.3.x:
  fix regression in #11017 properly

13 years agoMerge pull request #70 from duritong/2.3.x
Jeff McCune [Wed, 23 May 2012 17:45:35 +0000 (10:45 -0700)]
Merge pull request #70 from duritong/2.3.x

fix regression in #11017 properly

13 years agofix regression in #11017 properly
Peter Meier [Tue, 22 May 2012 17:39:29 +0000 (19:39 +0200)]
fix regression in #11017 properly

We need the defaultvalues for that.

13 years agoMerge branch '2.3.x'
Jeff McCune [Fri, 11 May 2012 07:03:54 +0000 (00:03 -0700)]
Merge branch '2.3.x'

* 2.3.x:
  Fix spec tests using the new spec_helper

13 years agoMerge branch '2.2.x' into 2.3.x
Jeff McCune [Fri, 11 May 2012 07:03:31 +0000 (00:03 -0700)]
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  Fix spec tests using the new spec_helper

13 years agoFix spec tests using the new spec_helper
Jeff McCune [Fri, 11 May 2012 05:01:40 +0000 (22:01 -0700)]
Fix spec tests using the new spec_helper

This patch back ports the file from the master branch.  The spec tests
fail without this patch applied.  This should make it easier to setup
Puppet settings using the puppet_spec_helper project.

13 years agoMerge branch '2.3.x'
Jeff McCune [Fri, 11 May 2012 05:25:14 +0000 (22:25 -0700)]
Merge branch '2.3.x'

* 2.3.x:
  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

13 years agoUpdate CHANGELOG for 2.3.2 release
Jeff McCune [Fri, 11 May 2012 05:19:24 +0000 (22:19 -0700)]
Update CHANGELOG for 2.3.2 release

13 years agoMerge branch 'fix/2.3.x/file_line_ensure' into 2.3.x
Jeff McCune [Fri, 11 May 2012 05:13:46 +0000 (22:13 -0700)]
Merge branch 'fix/2.3.x/file_line_ensure' into 2.3.x

* fix/2.3.x/file_line_ensure:
  Make file_line default to ensure => present
  Memoize file_line spec instance variables
  Fix spec tests using the new spec_helper

13 years agoMake file_line default to ensure => present
Jeff McCune [Fri, 11 May 2012 04:36:46 +0000 (21:36 -0700)]
Make file_line default to ensure => present

The examples in the file_line resource documentation state the following
resource should work:

    file_line { 'sudo_rule':
      path => '/etc/sudoers',
      line => '%sudo ALL=(ALL) ALL',
    }

Without this patch the example does not work because ensure is not set
to present.

This patch fixes the problem by setting the default value of ensure to
present.

13 years agoMemoize file_line spec instance variables
Jeff McCune [Fri, 11 May 2012 05:00:19 +0000 (22:00 -0700)]
Memoize file_line spec instance variables

This just changes the instance variables to a memoized let block and
gets ride of the before :each block.

The patch has no change in behavior.

13 years agoFix spec tests using the new spec_helper
Jeff McCune [Fri, 11 May 2012 05:01:40 +0000 (22:01 -0700)]
Fix spec tests using the new spec_helper

This patch back ports the file from the master branch.  The spec tests
fail without this patch applied.  This should make it easier to setup
Puppet settings using the puppet_spec_helper project.

13 years agoMerge branch '2.3.x'
Jeff McCune [Fri, 13 Apr 2012 16:57:26 +0000 (09:57 -0700)]
Merge branch '2.3.x'

* 2.3.x:
  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 agoMerge branch '2.2.x' into 2.3.x
Jeff McCune [Fri, 13 Apr 2012 16:56:41 +0000 (09:56 -0700)]
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  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 agoMerge pull request #61 from cprice-puppet/ticket/master/13693-use-puppetlabs-spec...
Chris Price [Thu, 12 Apr 2012 00:23:30 +0000 (17:23 -0700)]
Merge pull request #61 from cprice-puppet/ticket/master/13693-use-puppetlabs-spec-helper

(#13693) moving logic from local spec_helper to puppetlabs_spec_helper

13 years ago(#13693) moving logic from local spec_helper to puppetlabs_spec_helper
Chris Price [Tue, 10 Apr 2012 17:57:28 +0000 (10:57 -0700)]
(#13693) moving logic from local spec_helper to puppetlabs_spec_helper

This should simplify future compatibility between various versions
of stdlib and various versions of puppet core.

13 years agoRevert "Merge remote-tracking branch 'eshamow/tickets/bug/13595_restrict_initialize_e...
Jeff McCune [Wed, 4 Apr 2012 12:56:35 +0000 (08:56 -0400)]
Revert "Merge remote-tracking branch 'eshamow/tickets/bug/13595_restrict_initialize_everything_for_tests' into 2.2.x"

This reverts commit 40da421c0480f940638d0db9aabf180500d6ae5c, reversing
changes made to 69465b0f3e0c0c5284812bfa76ab8d3c254d10a9.

13 years agoMerge remote-tracking branch 'eshamow/tickets/bug/13595_restrict_initialize_everythin...
Jeff McCune [Wed, 4 Apr 2012 12:47:06 +0000 (08:47 -0400)]
Merge remote-tracking branch 'eshamow/tickets/bug/13595_restrict_initialize_everything_for_tests' into 2.2.x

* eshamow/tickets/bug/13595_restrict_initialize_everything_for_tests:
  (#13595) initialize_everything_for_tests couples modules Puppet ver

13 years ago(#13595) initialize_everything_for_tests couples modules Puppet ver
Eric Shamow [Wed, 4 Apr 2012 03:26:36 +0000 (23:26 -0400)]
(#13595) initialize_everything_for_tests couples modules Puppet ver

Replace regex used in spec_helper.rb to disallow both Puppet 2.6 and any
2.7 prior to 13.

13 years agoMerge branch '2.4.x'
Jeff McCune [Fri, 30 Mar 2012 06:21:09 +0000 (23:21 -0700)]
Merge branch '2.4.x'

* 2.4.x:
  (#13439) Fix MRI 1.9 issue with spec_helper

13 years agoMerge branch '2.3.x' into 2.4.x
Jeff McCune [Fri, 30 Mar 2012 06:21:00 +0000 (23:21 -0700)]
Merge branch '2.3.x' into 2.4.x

* 2.3.x:
  (#13439) Fix MRI 1.9 issue with spec_helper

13 years agoMerge branch '2.2.x' into 2.3.x
Jeff McCune [Fri, 30 Mar 2012 06:20:32 +0000 (23:20 -0700)]
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  (#13439) Fix MRI 1.9 issue with spec_helper

13 years agoMerge branch 'ticket/2.2.x/13439_fix_spec_helper_try3' into 2.2.x
Jeff McCune [Fri, 30 Mar 2012 06:18:39 +0000 (23:18 -0700)]
Merge branch 'ticket/2.2.x/13439_fix_spec_helper_try3' into 2.2.x

* ticket/2.2.x/13439_fix_spec_helper_try3:
  (#13439) Fix MRI 1.9 issue with spec_helper

13 years ago(#13439) Fix MRI 1.9 issue with spec_helper
Jeff McCune [Fri, 30 Mar 2012 06:04:12 +0000 (23:04 -0700)]
(#13439) Fix MRI 1.9 issue with spec_helper

When using MRI 1.9.x the stdlib spec helper does not invoke because
Puppet.settings.private_methods returns symbols instead of strings.

This is a problem because we need to set default configuration settings
like Puppet[:vardir] when using the compiler.

This patch fixes the issue by simply checking the Puppet version.  This
seems a better choice than rescuing NoMethodError since the method might
be renamed or removed in the future.

13 years agoMerge branch '2.4.x'
Jeff McCune [Thu, 29 Mar 2012 23:57:13 +0000 (16:57 -0700)]
Merge branch '2.4.x'

* 2.4.x:
  (#13439) Fix test failures with Puppet 2.6.x
  (#13439) refactor spec helper for compatibility with both puppet 2.7 and master

13 years agoMerge branch '2.3.x' into 2.4.x
Jeff McCune [Thu, 29 Mar 2012 23:56:26 +0000 (16:56 -0700)]
Merge branch '2.3.x' into 2.4.x

* 2.3.x:
  (#13439) Fix test failures with Puppet 2.6.x
  (#13439) refactor spec helper for compatibility with both puppet 2.7 and master

13 years agoMerge branch '2.2.x' into 2.3.x
Jeff McCune [Thu, 29 Mar 2012 23:55:46 +0000 (16:55 -0700)]
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  (#13439) Fix test failures with Puppet 2.6.x

13 years agoMerge branch 'ticket/2.2.x/13439_fix_spec_helper_try2' into 2.2.x
Jeff McCune [Thu, 29 Mar 2012 23:54:42 +0000 (16:54 -0700)]
Merge branch 'ticket/2.2.x/13439_fix_spec_helper_try2' into 2.2.x

* ticket/2.2.x/13439_fix_spec_helper_try2:
  (#13439) Fix test failures with Puppet 2.6.x

13 years ago(#13439) Fix test failures with Puppet 2.6.x
Jeff McCune [Thu, 29 Mar 2012 23:52:15 +0000 (16:52 -0700)]
(#13439) Fix test failures with Puppet 2.6.x

Without this patch the spec_helper sends a message named
initialize_everything_for_tests to Puppet.settings.  This is a problem
because Puppet 2.6.x does not have this method, only Puppet 2.7.x and
Puppet master have this method at this time and we're getting false
positive test failures.

This patch fixes the problem by looking before we leap.  We test if the
private method exists before calling it.  This works with Ruby 1.8.5 and
onwards and Puppet 2.6, 2.7 and master.

This should fix all of the failures I've caused in Jenkins today.

13 years agoMerge branch '2.2.x' into 2.3.x
Jeff McCune [Thu, 29 Mar 2012 23:26:13 +0000 (16:26 -0700)]
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  (#13439) refactor spec helper for compatibility with both puppet 2.7 and master

13 years agoMerge branch 'ticket/2.2.x/13439_fix_spec_helper' into 2.2.x
Jeff McCune [Thu, 29 Mar 2012 23:25:55 +0000 (16:25 -0700)]
Merge branch 'ticket/2.2.x/13439_fix_spec_helper' into 2.2.x

* ticket/2.2.x/13439_fix_spec_helper:
  (#13439) refactor spec helper for compatibility with both puppet 2.7 and master

13 years ago(#13439) refactor spec helper for compatibility with both puppet 2.7 and
cprice [Tue, 27 Mar 2012 17:38:38 +0000 (10:38 -0700)]
(#13439) refactor spec helper for compatibility with both puppet 2.7 and
master

13 years agoMerge pull request #53 from traylenator/fqdn_rotate
Jeff McCune [Thu, 29 Mar 2012 22:48:10 +0000 (15:48 -0700)]
Merge pull request #53 from traylenator/fqdn_rotate

(#13205) Rotate array/string randomley based on fqdn, fqdn_rotate()

13 years agoMerge branch '2.3.x'
Jeff McCune [Thu, 29 Mar 2012 22:20:41 +0000 (15:20 -0700)]
Merge branch '2.3.x'

* 2.3.x:
  (#13494) Specify the behavior of zero padded strings
  Update CHANGELOG, Modulefile for 2.1.3

13 years agoMerge branch '2.2.x' into 2.3.x
Jeff McCune [Thu, 29 Mar 2012 22:20:28 +0000 (15:20 -0700)]
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  (#13494) Specify the behavior of zero padded strings
  Update CHANGELOG, Modulefile for 2.1.3

Conflicts:
CHANGELOG
Modulefile

13 years agoMerge branch '2.1.x' into 2.2.x
Jeff McCune [Thu, 29 Mar 2012 22:19:21 +0000 (15:19 -0700)]
Merge branch '2.1.x' into 2.2.x

* 2.1.x:
  Update CHANGELOG, Modulefile for 2.1.3

Conflicts:
CHANGELOG
Modulefile

13 years agoMerge branch 'maint/2.2.x/range_spec_tests' into 2.2.x
Jeff McCune [Thu, 29 Mar 2012 22:17:48 +0000 (15:17 -0700)]
Merge branch 'maint/2.2.x/range_spec_tests' into 2.2.x

* maint/2.2.x/range_spec_tests:
  (#13494) Specify the behavior of zero padded strings

13 years ago(#13494) Specify the behavior of zero padded strings
Jeff McCune [Thu, 29 Mar 2012 22:12:06 +0000 (15:12 -0700)]
(#13494) Specify the behavior of zero padded strings

Without this patch the specified behavior of strings that are numeric
only and zero padded is unclear and untested in the spec tests.  This is
a problem because it's not clear that range('00', '10') will actually
return [ "0", "1", ..., "10" ] instead of [ "00", "01", ..., "10" ]

This patch addresses the issue by providing explicit test coverage.  If
the string conversion behavior of puppet changes, this test will begin
to fail.

13 years agoUpdate CHANGELOG, Modulefile for 2.1.3
Jeff McCune [Thu, 29 Mar 2012 16:43:20 +0000 (09:43 -0700)]
Update CHANGELOG, Modulefile for 2.1.3

13 years ago(#13205) Rotate array/string randomley based on fqdn, fqdn_rotate()
Steve Traylen [Fri, 16 Mar 2012 15:23:27 +0000 (16:23 +0100)]
(#13205) Rotate array/string randomley based on fqdn, fqdn_rotate()

13 years agoMerge branch '2.3.x'
Jeff McCune [Wed, 14 Mar 2012 00:48:09 +0000 (17:48 -0700)]
Merge branch '2.3.x'

* 2.3.x:
  Update CHANGELOG and Modulefile for 2.3.1
  (#13091) Fix LoadError exception with puppet apply

13 years agoUpdate CHANGELOG and Modulefile for 2.3.1
Jeff McCune [Wed, 14 Mar 2012 00:34:30 +0000 (17:34 -0700)]
Update CHANGELOG and Modulefile for 2.3.1

13 years agoMerge pull request #50 from jeffmccune/ticket/2.3.x/13091_stdlib_throws_a_loaderror_w...
Ken Barber [Wed, 14 Mar 2012 00:30:44 +0000 (17:30 -0700)]
Merge pull request #50 from jeffmccune/ticket/2.3.x/13091_stdlib_throws_a_loaderror_when_running_with_puppet_apply

(#13091) Fix LoadError exception with puppet apply

13 years ago(#13091) Fix LoadError exception with puppet apply
Jeff McCune [Tue, 13 Mar 2012 23:11:01 +0000 (16:11 -0700)]
(#13091) Fix LoadError exception with puppet apply

Puppet apply does not add the stdlib lib directory to the $LOAD_PATH.
This is a problem because the puppet_vardir fact requires the
puppet_settings library to be available for the `with_puppet` utility
method.

Without this patch, puppet apply will result in the following error:

    $ puppet apply --modulepath=/vagrant/modules -e 'notice $puppet_vardir'
    warning: Could not load fact file stdlib/lib/facter/puppet_vardir.rb: no such file to load -- facter/util/puppet_settings
    notice: Scope(Class[main]):
    notice: Finished catalog run in 0.01 seconds

With this patch applied, puppet apply works as expected:

    $ puppet apply --modulepath=/vagrant/modules.pe -e 'notice $puppet_vardir'
    notice: Scope(Class[main]): /Users/jeff/.puppet/var
    notice: Finished catalog run in 0.01 seconds

This patch defensively tries to load facter/util/puppet_settings.  If it cannot
load it, it falls back to trying to explicitly locate and load the library.

Once puppet is fixed such that a modules lib directory is truly in the
$LOAD_PATH, the fall back implementation will no longer be exercised since the
LoadError should not be raised.

13 years agoMerge branch '2.3.x'
Jeff McCune [Tue, 13 Mar 2012 00:45:35 +0000 (17:45 -0700)]
Merge branch '2.3.x'

* 2.3.x:
  Update CHANGELOG, Modulefile for 2.3.0 release

13 years agoUpdate CHANGELOG, Modulefile for 2.3.0 release
Jeff McCune [Tue, 13 Mar 2012 00:45:12 +0000 (17:45 -0700)]
Update CHANGELOG, Modulefile for 2.3.0 release

13 years agoMerge branch '2.3.x'
Jeff McCune [Tue, 13 Mar 2012 00:41:24 +0000 (17:41 -0700)]
Merge branch '2.3.x'

* 2.3.x:
  (#12357) Fix broken compatibility with Puppet 2.6
  (maint) Comment Ken's fix to String#any?
  (#13018) Fix missing method any? message for ruby 1.9.x
  (#12357) Add ability to display an error message from validate_re
  (#12357) Add validate_absolute_path() function
  (maint) Stop printing the directory of spec_helper
  (#12357) Make facter_dot_d look in Puppet[:confdir]/facts.d
  (#12357) Add puppet_vardir custom fact
  (#12357) Fix root_home fact on Windows

13 years agoMerge pull request #49 from jeffmccune/bug/2.3.x/fix_absolute_path_error_with_puppet26
Ken Barber [Mon, 12 Mar 2012 23:12:36 +0000 (16:12 -0700)]
Merge pull request #49 from jeffmccune/bug/2.3.x/fix_absolute_path_error_with_puppet26

(#12357) Fix broken compatibility with Puppet 2.6

13 years ago(#12357) Fix broken compatibility with Puppet 2.6
Jeff McCune [Mon, 12 Mar 2012 22:53:02 +0000 (15:53 -0700)]
(#12357) Fix broken compatibility with Puppet 2.6

Without this patch, the previous change set to the
validate_absolute_path() parser function contains Puppet 2.6
incompatible changes.  stdlib 2.x is compatible with Puppet 2.6.  These
changes are a problem because we cannot introduce backwards incompatible
changes in a minor release.

This patch fixes the problem by back porting the implementation of the
`Puppet::Util.absolute_path?` from 2.7.x to the function block itself.

The function block tests to see if `Puppet::Util.absolute_path?` will
respond and if not, falls back to the inline back ported implementation.

The spec tests have been updated to simulate the behavior of Puppet 2.6
even when running with Puppet 2.7.

13 years agoMerge branch 'ticket/2.3.x/13018_any_on_string' into 2.3.x
Jeff McCune [Fri, 9 Mar 2012 22:09:55 +0000 (14:09 -0800)]
Merge branch 'ticket/2.3.x/13018_any_on_string' into 2.3.x

* ticket/2.3.x/13018_any_on_string:
  (maint) Comment Ken's fix to String#any?
  (#13018) Fix missing method any? message for ruby 1.9.x

13 years ago(maint) Comment Ken's fix to String#any?
Jeff McCune [Fri, 9 Mar 2012 22:08:54 +0000 (14:08 -0800)]
(maint) Comment Ken's fix to String#any?

Just added a comment about why we're doing what we're doing.

13 years ago(#13018) Fix missing method any? message for ruby 1.9.x
Ken Barber [Thu, 8 Mar 2012 03:55:21 +0000 (19:55 -0800)]
(#13018) Fix missing method any? message for ruby 1.9.x

The any? method doesn't exist for 1.9.x, this converts a string to a single
element array to work around the problem.

13 years agoMerge pull request #47 from jeffmccune/feature/2.3.x/validate_re_better_error_messages
Ken Barber [Wed, 7 Mar 2012 23:33:58 +0000 (15:33 -0800)]
Merge pull request #47 from jeffmccune/feature/2.3.x/validate_re_better_error_messages

(#12357) Add ability to display an error message from validate_re

13 years ago(#12357) Add ability to display an error message from validate_re
Jeff McCune [Wed, 7 Mar 2012 23:01:11 +0000 (15:01 -0800)]
(#12357) Add ability to display an error message from validate_re

I've seen a number of times the following error displayed to the end
user:

    validate_re(): "" does not match "^true$|^false$" at /p/t/f.pp:40

This is an absolutely horrific error message.  I'm to blame for it.
Users stumble over this quite often and they shouldn't have to go read
the code to sort out what's happening.

This patch makes an effort to fix the problem by adding a third,
optional, argument to validate_re().  This third argument will be the
message thrown back in the exception which will be displayed to the end
user.

This sets the stage for nicer error messages coming from modules we
write.

This patch is backwards compatible but is a new feature.

13 years agoMerge pull request #46 from jeffmccune/feature/2.3.x/validate_absolute_path_function
Ken Barber [Wed, 7 Mar 2012 21:05:18 +0000 (13:05 -0800)]
Merge pull request #46 from jeffmccune/feature/2.3.x/validate_absolute_path_function

(#12357) Add validate_absolute_path() function

13 years ago(#12357) Add validate_absolute_path() function
Jeff McCune [Wed, 7 Mar 2012 19:52:30 +0000 (11:52 -0800)]
(#12357) Add validate_absolute_path() function

This patch adds a new function to validate if a string is an absolute
filesystem path or not.

The intent of this is to make this functionality generic and reusable.
Josh left a comment in another pull request I had:

    If node_installdir or $node_vardir is not defined, then we should
    raise an error, otherwise we may create a scheduled task to an
    untrusted directory.

One solution to this comment is to validate the Puppet variable is an
absolute path.

Examples of this function look like:

    function_validate_absolute_path
      Using Puppet::Parser::Scope.new
        Garbage inputs
          validate_absolute_path(nil) should fail
          validate_absolute_path([nil]) should fail
          validate_absolute_path({"foo"=>"bar"}) should fail
          validate_absolute_path({}) should fail
          validate_absolute_path("") should fail
        relative paths
          validate_absolute_path("relative1") should fail
          validate_absolute_path(".") should fail
          validate_absolute_path("..") should fail
          validate_absolute_path("./foo") should fail
          validate_absolute_path("../foo") should fail
          validate_absolute_path("etc/puppetlabs/puppet") should fail
          validate_absolute_path("opt/puppet/bin") should fail
        absolute paths
          validate_absolute_path("C:/") should not fail
          validate_absolute_path("C:\\") should not fail
          validate_absolute_path("C:\\WINDOWS\\System32") should not fail
          validate_absolute_path("C:/windows/system32") should not fail
          validate_absolute_path("X:/foo/bar") should not fail
          validate_absolute_path("X:\\foo\\bar") should not fail
          validate_absolute_path("/var/tmp") should not fail
          validate_absolute_path("/var/lib/puppet") should not fail
          validate_absolute_path("/var/opt/../lib/puppet") should not fail
          validate_absolute_path("C:\\Program Files (x86)\\Puppet Labs\\Puppet Enterprise") should not fail
          validate_absolute_path("C:/Program Files (x86)/Puppet Labs/Puppet Enterprise") should not fail

    Finished in 0.05637 seconds
    23 examples, 0 failures