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

13 years ago(maint) Stop printing the directory of spec_helper
Jeff McCune [Wed, 7 Mar 2012 19:51:31 +0000 (11:51 -0800)]
(maint) Stop printing the directory of spec_helper

Without this patch every rspec run prints out the directory of the
spec_helper script.

I think this was just a debugging line or whatever that accidentally got
added.

13 years agoMerge pull request #44 from jeffmccune/ticket/2.3.x/12357_add_puppet_settings_facts
Josh Cooper [Wed, 7 Mar 2012 01:14:35 +0000 (17:14 -0800)]
Merge pull request #44 from jeffmccune/ticket/2.3.x/12357_add_puppet_settings_facts

(#12357) Make facter_dot_d look in Puppet[:confdir]/facts.d

13 years ago(#12357) Make facter_dot_d look in Puppet[:confdir]/facts.d
Jeff McCune [Tue, 28 Feb 2012 19:53:15 +0000 (11:53 -0800)]
(#12357) Make facter_dot_d look in Puppet[:confdir]/facts.d

On Windows, we have no folders that match up to the default set of
directories the facter_dot_d fact looks in by default.  This is a
problem because the Puppet Enterprise installer writes out the following
facts by default, and our modules require them to be present:

    % cat /etc/puppetlabs/facter/facts.d/puppet_enterprise_installer.txt
    fact_stomp_port=61613
    fact_stomp_server=puppetmaster
    fact_is_puppetagent=true
    fact_is_puppetmaster=true
    fact_is_puppetconsole=true

On windows, the Puppet confdir is quite variable.  On 2003 systems we
default to the All Users application data directory.  On 2008 systems we
default to the ProgramData directory.  The actual configuration
directory varies depending on the Puppet or Puppet Enterprise branding.

In order to simplify all of this variable behavior, this patch fixes the
problem by automatically looking for facts in
`%COMMON_APPDATA%/PuppetLabs/facter/facts.d`

This patch paves the way for the MSI installer to use an IniFile element
to write custom facts during installation.

13 years agoMerge pull request #45 from jeffmccune/ticket/2.3.x/12357_disable_root_home_fact_on_w...
Josh Cooper [Tue, 6 Mar 2012 23:53:08 +0000 (15:53 -0800)]
Merge pull request #45 from jeffmccune/ticket/2.3.x/12357_disable_root_home_fact_on_windows

(#12357) Fix root_home fact on Windows

13 years ago(#12357) Add puppet_vardir custom fact
Jeff McCune [Wed, 29 Feb 2012 20:47:08 +0000 (12:47 -0800)]
(#12357) Add puppet_vardir custom fact

Without this patch the PE modules don't have a way to identify a
filesystem path where it's OK to place variable data related to managing
the target node.  This is a problem when a module like pe_compliance
needs to write a wrapper script to the node's filesystem.

This patch addresses the problem by exposing the node's Puppet[:vardir]
setting as a Facter fact.

This fact value will be set to `nil` if Puppet is not loaded into
memory.  If Puppet is loaded, e.g. using `facter --puppet` or using
`puppet agent` or `puppet apply` then the fact will automatically set
the value to Puppet[:vardir]

The value of this setting is subject to Puppet's run_mode.

This patch implements a new utility method in the standard library
module named `Facter::Util::PuppetSettings.with_puppet`.  The method
accepts a block and will only invoke the block if the Puppet library is
loaded into the Ruby process.  If Puppet is not loaded, the method
always returns nil.  This makes it easy to define Facter facts that only
give values if Puppet is loaded in memory.

13 years ago(#12357) Fix root_home fact on Windows
Jeff McCune [Tue, 28 Feb 2012 19:01:15 +0000 (11:01 -0800)]
(#12357) Fix root_home fact on Windows

Without this patch the root_home fact fails on windows.  This patch
fixes the problem by only calling methods on the object returned by the
`getent passwd root` command if the object evaluates to true.

Because there is no root account on Windows the code block simply
returns `nil` which makes the Facter fact undefined on Windows
platforms.

The root cause of the failure is that we always expected the command to
succeed and return something useful, and it may not on all supported
platforms.

13 years agoMerge pull request #37 from fiddyspence/ticket/master/12776-validate_slength
Ken Barber [Wed, 22 Feb 2012 18:46:37 +0000 (10:46 -0800)]
Merge pull request #37 from fiddyspence/ticket/master/12776-validate_slength

(#12776) Added validate_slength function and rspec test

13 years ago(#12776) Added validate_slength function and rspec test
Chris Spence [Wed, 22 Feb 2012 15:46:07 +0000 (15:46 +0000)]
(#12776) Added validate_slength function and rspec test

This function is used to validate a string is less than a maximum length.  The
string, or array of strings, is passed as the first argument to the function.
The maximum length of the string is passed as the second argument.

It is useful to validate, for example, that Puppet is not sending a username
to a downstream system that the system cannot cope with, but that might not
cause an error message - for example, MySQL will not accept a username of
more than 16 characters.  This enables a Puppet administrator to validate
the data that it may have been passed from upstream through, for example,
Hiera.

13 years agoMerge pull request #36 from duritong/tickets/11017
Daniel Pittman [Thu, 9 Feb 2012 19:45:20 +0000 (11:45 -0800)]
Merge pull request #36 from duritong/tickets/11017

implement #11017 - make file_line type ensurable

13 years agoimplement #11017 - make file_line type ensurable
Peter Meier [Thu, 9 Feb 2012 14:56:09 +0000 (15:56 +0100)]
implement #11017 - make file_line type ensurable

* Implement a simple destroy method.
* Add tests for it
* Refactor code, so file is actually read only once. However, due
  to the nature how provider tests are run, we need to ensure that
  the file is read before we open it to write it.

13 years agoMerge branch '2.2.x'
Ken Barber [Tue, 7 Feb 2012 13:44:58 +0000 (13:44 +0000)]
Merge branch '2.2.x'

* 2.2.x:
  (#12377) Avoid infinite loop when retrying require json

13 years agoMerge branch '2.1.x' into 2.2.x
Ken Barber [Tue, 7 Feb 2012 13:37:16 +0000 (13:37 +0000)]
Merge branch '2.1.x' into 2.2.x

* 2.1.x:
  (#12377) Avoid infinite loop when retrying require json

13 years agoMerge branch 'ticket/2.2.x/12377_stdlib_facter_dot_d_loaderror_recovery_may_be_harmfu...
Ken Barber [Mon, 6 Feb 2012 17:55:43 +0000 (17:55 +0000)]
Merge branch 'ticket/2.2.x/12377_stdlib_facter_dot_d_loaderror_recovery_may_be_harmful' into 2.1.x

* ticket/2.2.x/12377_stdlib_facter_dot_d_loaderror_recovery_may_be_harmful:
  (#12377) Avoid infinite loop when retrying require json

13 years ago(#12377) Avoid infinite loop when retrying require json
Jeff McCune [Mon, 6 Feb 2012 05:22:27 +0000 (21:22 -0800)]
(#12377) Avoid infinite loop when retrying require json

Without this patch an infinite loop will be entered if the json and
rubygems libraries are not available.

This patch fixes the problem by retrying the `require 'json'` only if
rubygems was successfully loaded for the first time.  Subsequent
attempts to load rubygems will cause the LoadError exception from a
missing json library to be re-raised.

Thanks to Krzysztof Wilczynski for pointing out this issue.

14 years agoMerge pull request #33 from richardc/master
Jeff McCune [Fri, 3 Feb 2012 18:17:00 +0000 (10:17 -0800)]
Merge pull request #33 from richardc/master

Update a documentation comment - facts_dot_d

14 years agoUpdate the documentation comment
Richard Clamp [Fri, 3 Feb 2012 14:19:50 +0000 (14:19 +0000)]
Update the documentation comment

This is causing a little confusion, so make the comment match
the behaviour.

14 years agoMerge branch '2.2.x'
Jeff McCune [Thu, 12 Jan 2012 03:19:51 +0000 (19:19 -0800)]
Merge branch '2.2.x'

* 2.2.x:
  Check according to rfc1035
  Add additional domain name tests
  (maint) Memoize scope in domain_name spec

14 years agoMerge branch 'bug/2.2.x/is_domain_name' into 2.2.x
Jeff McCune [Thu, 12 Jan 2012 03:19:02 +0000 (19:19 -0800)]
Merge branch 'bug/2.2.x/is_domain_name' into 2.2.x

* bug/2.2.x/is_domain_name:
  Check according to rfc1035
  Add additional domain name tests
  (maint) Memoize scope in domain_name spec

Closes pull request GH-24

14 years agoCheck according to rfc1035
Stig Sandbeck Mathisen [Wed, 9 Nov 2011 08:02:09 +0000 (09:02 +0100)]
Check according to rfc1035

Update doc string to match function

14 years agoAdd additional domain name tests
Jeff McCune [Thu, 12 Jan 2012 03:15:04 +0000 (19:15 -0800)]
Add additional domain name tests

Without this patch some valid domain names are not covered in the spec
tests as Stig Sandbeck Mathisen <ssm@debian.org> points out.  This patch
adds spec tests for the domains "." and "x.com" which are both valid.

14 years ago(maint) Memoize scope in domain_name spec
Jeff McCune [Thu, 12 Jan 2012 02:55:21 +0000 (18:55 -0800)]
(maint) Memoize scope in domain_name spec

This is an opportunity improvement since I'm in the code.  Get rid of
instance variables in the spec test and replace them with a memo let
method block.

14 years agoMerge branch '2.2.x'
Jeff McCune [Thu, 12 Jan 2012 01:48:57 +0000 (17:48 -0800)]
Merge branch '2.2.x'

* 2.2.x:
  (#11901) Fix sort order error in tests for 'keys' and 'values'

14 years agoMerge branch 'ticket/2.2.x/11901-rspec_sort_order' into 2.2.x
Jeff McCune [Thu, 12 Jan 2012 01:48:30 +0000 (17:48 -0800)]
Merge branch 'ticket/2.2.x/11901-rspec_sort_order' into 2.2.x

* ticket/2.2.x/11901-rspec_sort_order:
  (#11901) Fix sort order error in tests for 'keys' and 'values'

14 years ago(#11901) Fix sort order error in tests for 'keys' and 'values'
Jeff McCune [Thu, 12 Jan 2012 01:39:15 +0000 (17:39 -0800)]
(#11901) Fix sort order error in tests for 'keys' and 'values'

Between Ruby 1.8.7 p352 and p357 the way arrays were returned when using
keys and values in Ruby changed, and due to assumption about the
ordering our tests are now failing.

This patch fixes the issue by using the =~ operator matcher in rspec.
This matcher is implemented as RSpec::Matchers::MatchArray and performs
multiset equality matching of arrays.  Order doesn't matter, but
duplicate values do.

This patch also switches @scope instance variables to memoized let
methods for clarity in the code.

Original Author: Ken Barber
Reviewed-by: Nick Lewis
This commit closes GH-29

14 years agoMerge branch '2.2.x'
Ken Barber [Wed, 11 Jan 2012 14:53:13 +0000 (14:53 +0000)]
Merge branch '2.2.x'

* 2.2.x:
  (#11873) time function spec failure on Fixnum matcher

14 years agoMerge pull request #28 from kbarber/ticket/2.2.x/11873-time_spec_failure
Daniel Pittman [Tue, 10 Jan 2012 19:01:32 +0000 (11:01 -0800)]
Merge pull request #28 from kbarber/ticket/2.2.x/11873-time_spec_failure

(#11873) time function spec failure on Fixnum matcher

14 years ago(#11873) time function spec failure on Fixnum matcher
Ken Barber [Tue, 10 Jan 2012 18:58:07 +0000 (18:58 +0000)]
(#11873) time function spec failure on Fixnum matcher

The rspec code for the time function was trying to match the type to be a
'Fixnum'. Ruby will sometimes make this a 'Bignum' depending on its internals
and we can't rely on this to be true all the time.

This patch just makes sure the type is an integer instead.

14 years agoMerge pull request #27 from glarizza/feature/master/str2saltedsha512
Jeff McCune [Mon, 9 Jan 2012 19:47:57 +0000 (11:47 -0800)]
Merge pull request #27 from glarizza/feature/master/str2saltedsha512

New str2saltedsha512 function for OS X Passwords

14 years agoNew str2saltedsha512 function for OS X Passwords
Gary Larizza [Mon, 9 Jan 2012 19:30:47 +0000 (11:30 -0800)]
New str2saltedsha512 function for OS X Passwords

OS X 10.7 introduced salted-SHA512 password hashes as opposed to the
older LANMAN + SHA1 hashes. To assist in generating properly-formatted
password hashes, this commit adds the str2saltedsha512() function which
accepts a single string argument (the password) and returns a
salted-SHA512 password hash which can be fed as the password attribute
of a user resource in OS X 10.7.

Spec tests are also added to ensure that functionality isn't broken with
future commits.

14 years agoMerge branch '2.2.x'
Jeff McCune [Fri, 30 Dec 2011 23:49:53 +0000 (15:49 -0800)]
Merge branch '2.2.x'

* 2.2.x:
  (#11607) Add Rakefile to enable spec testing

14 years agoMerge branch '2.1.x' into 2.2.x
Jeff McCune [Fri, 30 Dec 2011 23:49:41 +0000 (15:49 -0800)]
Merge branch '2.1.x' into 2.2.x

* 2.1.x:
  (#11607) Add Rakefile to enable spec testing