]> gitweb.fluxo.info Git - puppet-stdlib.git/log
puppet-stdlib.git
11 years agoAdd some acceptance tests for functions.
Ashley Penney [Thu, 13 Mar 2014 18:21:38 +0000 (18:21 +0000)]
Add some acceptance tests for functions.

11 years agoMerge pull request #236 from PierreRambaud/patch-1
Ashley Penney [Thu, 27 Mar 2014 12:41:43 +0000 (08:41 -0400)]
Merge pull request #236 from PierreRambaud/patch-1

Update README.markdown

11 years agoUpdate README.markdown
GoT [Thu, 27 Mar 2014 10:56:17 +0000 (11:56 +0100)]
Update README.markdown

Add code block for validate_slength.

11 years agoMerge branch '4.x'
Adrien Thebo [Tue, 25 Mar 2014 20:26:12 +0000 (13:26 -0700)]
Merge branch '4.x'

11 years agoMerge branch '3.x' into 4.x
Adrien Thebo [Tue, 25 Mar 2014 20:26:00 +0000 (13:26 -0700)]
Merge branch '3.x' into 4.x

11 years agoMerge branch '3.2.x' into 3.x
Adrien Thebo [Tue, 25 Mar 2014 20:25:31 +0000 (13:25 -0700)]
Merge branch '3.2.x' into 3.x

11 years agoMerge branch 'maint/3.2.x-ruby-rake-1.8-compat' into 3.2.x
Adrien Thebo [Tue, 25 Mar 2014 20:24:49 +0000 (13:24 -0700)]
Merge branch 'maint/3.2.x-ruby-rake-1.8-compat' into 3.2.x

11 years ago(maint) Pin rake version to 10.1.0 for 1.8 compat
Adrien Thebo [Tue, 25 Mar 2014 16:46:53 +0000 (09:46 -0700)]
(maint) Pin rake version to 10.1.0 for 1.8 compat

11 years agoMerge branch '4.x'
Hunter Haugen [Tue, 18 Mar 2014 23:24:02 +0000 (16:24 -0700)]
Merge branch '4.x'

11 years agoMerge branch '3.x' into 4.x
Hunter Haugen [Tue, 18 Mar 2014 23:18:53 +0000 (16:18 -0700)]
Merge branch '3.x' into 4.x

11 years agoMerge branch '3.2.x' into 3.x
Hunter Haugen [Tue, 18 Mar 2014 23:16:00 +0000 (16:16 -0700)]
Merge branch '3.2.x' into 3.x

11 years agoMerge pull request #231 from apenney/32-testing
Ashley Penney [Tue, 18 Mar 2014 16:34:40 +0000 (12:34 -0400)]
Merge pull request #231 from apenney/32-testing

Numerous changes to update testing gems.

11 years agoRemove this test.
Ashley Penney [Thu, 13 Mar 2014 18:10:01 +0000 (11:10 -0700)]
Remove this test.

It turns out that in 3.x the refresh functionality doesn't actually
exist yet, so testing it makes no sense.

11 years agoMerge pull request #234 from apenney/add-beaker
Ashley Penney [Wed, 12 Mar 2014 18:24:32 +0000 (11:24 -0700)]
Merge pull request #234 from apenney/add-beaker

Add beaker framework.

11 years agoAdd beaker framework.
Ashley Penney [Wed, 12 Mar 2014 18:22:23 +0000 (18:22 +0000)]
Add beaker framework.

This prepares the module for beaker acceptance tests.

11 years agoMerge pull request #220 from mediatemple/fix/master/deep_merge_fix
Ashley Penney [Tue, 11 Mar 2014 16:31:23 +0000 (09:31 -0700)]
Merge pull request #220 from mediatemple/fix/master/deep_merge_fix

PUP-1724 Don't modify the paramaters to deep_merge

11 years agoMerge pull request #221 from puphpet/hash-fix
Ashley Penney [Tue, 11 Mar 2014 16:29:46 +0000 (09:29 -0700)]
Merge pull request #221 from puphpet/hash-fix

hash example has misplaced comas

11 years agoEnsure Gemfile retains facilities for Jenkins.
Ashley Penney [Tue, 11 Mar 2014 16:21:37 +0000 (09:21 -0700)]
Ensure Gemfile retains facilities for Jenkins.

11 years agoMerge pull request #233 from apenney/add-back-location
Ashley Penney [Mon, 10 Mar 2014 22:22:56 +0000 (15:22 -0700)]
Merge pull request #233 from apenney/add-back-location

Make sure location_for is used when installing Puppet.

11 years agoMake sure location_for is used when installing Puppet.
Ashley Penney [Mon, 10 Mar 2014 22:19:03 +0000 (15:19 -0700)]
Make sure location_for is used when installing Puppet.

11 years agoMerge pull request #232 from apenney/add-back-location
Ashley Penney [Mon, 10 Mar 2014 21:58:25 +0000 (14:58 -0700)]
Merge pull request #232 from apenney/add-back-location

Readd location_for

11 years agoReadd location_for
Ashley Penney [Mon, 10 Mar 2014 21:56:12 +0000 (14:56 -0700)]
Readd location_for

location_for is used in Jenkins to transform a passed in git
repo into something usable by bundler.

11 years agoRemove pry, whoops.
Ashley Penney [Mon, 10 Mar 2014 20:07:43 +0000 (13:07 -0700)]
Remove pry, whoops.

11 years agoNumerous changes to update testing gems.
Ashley Penney [Wed, 5 Mar 2014 20:43:58 +0000 (15:43 -0500)]
Numerous changes to update testing gems.

This work updates a number of Gems to the latest versions (rspec,
rspec-puppet), and updates and tweaks a bunch of tests to work
with the updated gems.

11 years agoMerge pull request #230 from apenney/fix-testing
Ashley Penney [Sat, 8 Mar 2014 00:48:40 +0000 (19:48 -0500)]
Merge pull request #230 from apenney/fix-testing

[WIP] Spec overhaul.

11 years agoNumerous changes to update testing gems.
Ashley Penney [Wed, 5 Mar 2014 20:43:58 +0000 (15:43 -0500)]
Numerous changes to update testing gems.

This work updates a number of Gems to the latest versions (rspec,
rspec-puppet), and updates and tweaks a bunch of tests to work
with the updated gems.

11 years agoMerge pull request #228 from hunner/fix_metadata
Ashley Penney [Mon, 3 Mar 2014 21:59:29 +0000 (16:59 -0500)]
Merge pull request #228 from hunner/fix_metadata

Patch metadata

11 years agoPatch metadata
Hunter Haugen [Mon, 3 Mar 2014 21:56:13 +0000 (13:56 -0800)]
Patch metadata

11 years agoMerge pull request #227 from hunner/add_support
Ashley Penney [Mon, 3 Mar 2014 20:48:41 +0000 (15:48 -0500)]
Merge pull request #227 from hunner/add_support

Supported Release 3.2.1

11 years agoSupported Release 3.2.1
Hunter Haugen [Mon, 3 Mar 2014 20:45:43 +0000 (12:45 -0800)]
Supported Release 3.2.1

Summary
This is a supported release

Bugfixes
- Fixed `is_integer`/`is_float`/`is_numeric` for checking the value of
  arithmatic expressions.

Known bugs
* No known bugs

11 years agoMerge pull request #226 from apenney/supported-metadata
Hunter Haugen [Mon, 3 Mar 2014 18:55:28 +0000 (10:55 -0800)]
Merge pull request #226 from apenney/supported-metadata

[don't merge] Prepare for supported modules.

11 years agoPrepare for supported modules.
Ashley Penney [Mon, 3 Mar 2014 17:47:04 +0000 (17:47 +0000)]
Prepare for supported modules.

11 years agohash example has misplaced comas
Juan Treminio [Thu, 20 Feb 2014 05:37:38 +0000 (23:37 -0600)]
hash example has misplaced comas

11 years agoPUP-1724 Don't modify the paramaters to deep_merge
Justin Burnham [Mon, 17 Feb 2014 19:46:55 +0000 (11:46 -0800)]
PUP-1724 Don't modify the paramaters to deep_merge

Instead of modifying the first paramater of deep_merge due to the
use of the merge! function, instead use merge to return a copy of
the merged object. This allows one to continue to use the original
first parameter after the call to deep_merge.

11 years agoMerge pull request #217 from teancom/fix/master/file_line
Ashley Penney [Tue, 11 Feb 2014 17:51:37 +0000 (12:51 -0500)]
Merge pull request #217 from teancom/fix/master/file_line

(DOCUMENT-21) add docs for file_line to README.markdown

11 years agoMerge pull request #219 from petems/patch-1
Ashley Penney [Tue, 11 Feb 2014 17:51:22 +0000 (12:51 -0500)]
Merge pull request #219 from petems/patch-1

Fix strftime documentation in README

11 years agoFix strftime documentation in README
Peter Souter [Tue, 11 Feb 2014 15:57:22 +0000 (15:57 +0000)]
Fix strftime documentation in README

Markdown was barfing due to typo

11 years agoMerge pull request #218 from mediatemple/remove_trailing_whitespace
Hunter Haugen [Wed, 5 Feb 2014 23:06:09 +0000 (15:06 -0800)]
Merge pull request #218 from mediatemple/remove_trailing_whitespace

Remove trailing whitespace

11 years agoRemove trailing whitespace
Sharif Nassar [Wed, 5 Feb 2014 23:01:45 +0000 (15:01 -0800)]
Remove trailing whitespace

12 years agoMerge branch 'DavidS-broaden-pick-arguments2'
Andrew Parker [Wed, 29 Jan 2014 17:28:48 +0000 (09:28 -0800)]
Merge branch 'DavidS-broaden-pick-arguments2'

* DavidS-broaden-pick-arguments2:
  (PUP-638) Add a pick_default() function that always returns a value.
  (PUP-636) Ignore generated file

12 years ago(PUP-638) Add a pick_default() function that always returns a value.
David Schmitt [Thu, 23 Jan 2014 14:22:27 +0000 (15:22 +0100)]
(PUP-638) Add a pick_default() function that always returns a value.

This version of pick() does not error out, instead always returning at least
the last argument, even if that too has no "real" value.

12 years ago(PUP-636) Ignore generated file
David Schmitt [Wed, 14 Aug 2013 08:33:39 +0000 (10:33 +0200)]
(PUP-636) Ignore generated file

12 years agoMerge pull request #215 from blkperl/add_root_home_to_mavericks
Andrew Parker [Tue, 28 Jan 2014 18:52:58 +0000 (10:52 -0800)]
Merge pull request #215 from blkperl/add_root_home_to_mavericks

(PUP-1459) Add support for root_home on OS X 10.9

12 years ago(DOCUMENT-21) add docs for file_line to README.markdown
David Bishop [Sat, 25 Jan 2014 18:23:17 +0000 (13:23 -0500)]
(DOCUMENT-21) add docs for file_line to README.markdown

Without this, you have to look at the source file
(lib/puppet/type/file_line.rb) to know what it does. This adds that
documentation.

12 years ago(PUP-1195) Rephrase documentation for is_integer and is_numeric
Henrik Lindberg [Thu, 23 Jan 2014 23:22:09 +0000 (00:22 +0100)]
(PUP-1195) Rephrase documentation for is_integer and is_numeric

The documentation contained references to future decisions about
functionality.
Text rephrased for clarity.

12 years ago(PUP-1195) Fix is_numeric/is_integer when checking non-string parameters
Simon Effenberg [Thu, 19 Dec 2013 23:13:39 +0000 (00:13 +0100)]
(PUP-1195) Fix is_numeric/is_integer when checking non-string parameters

I expect a function called "is_numeric" or "is_integer" to check if a
variable is an integer or a number even if the variable passed by isn't
a string nor a number at all. Otherwise we should call them
is_string_a_number and is_string_an_integer and we have then to remove
the check for .is_a?(Number) and .is_a?(FixNum)

now checking also if it is a hex or octal number

improved/corrected checking for integer

* checking against Integer instead of Fixnum so that
  also Bignum is matching
* now .is_a? Integer is done first so this is quiet fast

Now many types of numerics are recognized.

1. Float/Integer values (signed or unsigned, with exponent or without)
2. octal and hex check
3. except hex numbers and the "0." in a float lower than 1 can be prefixed
   with a '0'.

whitespaces shouldn't be allowed as prefix/suffix

string representation of numbers should not contain any type of
whitespace.. the user is responsible to clean a string before checking
it..

fix documentation and added more checks

tried to be 99.9% backward compatible

* for now the decission is post poned if hex and octal numbers
  should be allowed or not (is_numeric)
* native Bignum is now also a valid integer class

fix problem with old 1.8 ruby and Hash.to_s/Array.to_s

In ruby < 1.9 array and hashes would be recognized as numeric
if they have a special format:

1.8:

  [1,2,3,4].to_s = "1234"
  {1=>2}.to_s    = "12"

1.9:

  [1,2,3,4].to_s = "[1, 2, 3, 4]"
  {1=>2}.to_s    = "{1=>2}"

12 years agoMerge pull request #216 from ghoneycutt/enable_travis_fast_finish
Hunter Haugen [Thu, 23 Jan 2014 22:49:56 +0000 (14:49 -0800)]
Merge pull request #216 from ghoneycutt/enable_travis_fast_finish

Enable fast finish in Travis

12 years agoEnable fast finish in Travis
Garrett Honeycutt [Thu, 23 Jan 2014 19:18:50 +0000 (14:18 -0500)]
Enable fast finish in Travis

http://blog.travis-ci.com/2013-11-27-fast-finishing-builds/

12 years ago(PUP-1459) Add support for root_home on OS X 10.9
William Van Hevelingen [Fri, 17 Jan 2014 06:22:38 +0000 (22:22 -0800)]
(PUP-1459) Add support for root_home on OS X 10.9

getent does not exist on 10.9 so this commit uses
dscacheutil to query the homedir for the root user.

12 years agoMerge branch 'pull-201'
Adrien Thebo [Wed, 15 Jan 2014 19:17:48 +0000 (11:17 -0800)]
Merge branch 'pull-201'

This closes GH-201.

12 years ago(maint) Update ensure_package specs to confirm expected behavior
Adrien Thebo [Wed, 15 Jan 2014 19:04:03 +0000 (11:04 -0800)]
(maint) Update ensure_package specs to confirm expected behavior

The previous behavior of the tests checked the behavior of the
underlying functions library when called with no arguments; this commit
updates the tests to conform to the functions API and test what happens
when a function is called with no args.

12 years ago(maint) refactor ensure_packages for clarity
Adrien Thebo [Wed, 15 Jan 2014 19:03:49 +0000 (11:03 -0800)]
(maint) refactor ensure_packages for clarity

12 years agoAllow a single argument, rather than an array
Tomas Doran [Tue, 19 Nov 2013 18:38:12 +0000 (18:38 +0000)]
Allow a single argument, rather than an array

12 years agoMerge pull request #214 from zaphod42/maint/master/update-references-for-jira
Andrew Parker [Thu, 26 Dec 2013 17:36:44 +0000 (09:36 -0800)]
Merge pull request #214 from zaphod42/maint/master/update-references-for-jira

(doc) Update to point to Jira

12 years ago(doc) Update to point to Jira
Andrew Parker [Mon, 23 Dec 2013 23:35:08 +0000 (15:35 -0800)]
(doc) Update to point to Jira

Since we've moved from Redmine to Jira the links need to be updated so
that people know where to look for issues.

At the moment stdlib is being tracked with puppet in the PUP project.
This doesn't seem like a good, long term solution, but it is where we
are right now.

12 years agoMerge branch 'pull-209'
Adrien Thebo [Fri, 20 Dec 2013 23:04:18 +0000 (15:04 -0800)]
Merge branch 'pull-209'

This closes GH-209

12 years ago(maint) Improve test coverage for prefix and suffix
Adrien Thebo [Fri, 20 Dec 2013 22:59:51 +0000 (14:59 -0800)]
(maint) Improve test coverage for prefix and suffix

12 years agoFix prefix exception message (Closes #23364)
Franco Catena [Thu, 5 Dec 2013 19:11:59 +0000 (16:11 -0300)]
Fix prefix exception message (Closes #23364)

12 years ago(Maint) Update stubbing to work with facter 1.7.4
Andrew Parker [Wed, 18 Dec 2013 22:46:54 +0000 (14:46 -0800)]
(Maint) Update stubbing to work with facter 1.7.4

Facter 1.7.4 changed how it decides on what directory to look in for
facts.d based on the user it is running as. This stubs out that bit of
code to make it think it is running as root.

12 years agoMerge pull request #211 from jhoblitt/function_is_bool
Andrew Parker [Wed, 18 Dec 2013 18:49:39 +0000 (10:49 -0800)]
Merge pull request #211 from jhoblitt/function_is_bool

(#23381) add is_bool() function

12 years agoMerge pull request #208 from ghoneycutt/add_validation
Andrew Parker [Wed, 18 Dec 2013 18:45:10 +0000 (10:45 -0800)]
Merge pull request #208 from ghoneycutt/add_validation

Add rake tasks to validate and lint files and check with Travis

12 years agoMerge pull request #207 from ghoneycutt/remove_unintentional_link
Josh Cooper [Wed, 18 Dec 2013 18:38:40 +0000 (10:38 -0800)]
Merge pull request #207 from ghoneycutt/remove_unintentional_link

Remove unintentional link from README

12 years agoMerge pull request #203 from dreamlibrarian/fix/is_function_available-ruby_c
Andrew Parker [Wed, 18 Dec 2013 18:31:39 +0000 (10:31 -0800)]
Merge pull request #203 from dreamlibrarian/fix/is_function_available-ruby_c

calling rspec directly makes is_function_available.rb not pass ruby -c

12 years ago(maint) Update README stating stdlib 4.x supports Puppet 2.7.x
Jeff McCune [Thu, 12 Dec 2013 16:12:12 +0000 (11:12 -0500)]
(maint) Update README stating stdlib 4.x supports Puppet 2.7.x

Without this patch there is a disconnect between the documentation in
the README and our decision to not merge pull requests into the 4.x
series that break compatibility with Puppet 2.7.x

For example:

    @jeffmccune I think the real issue here is that "policy" is out of sync with
    the documentation. The README claims that 4.x does not support puppet 2.7.x,
    yet the "policy" is not to merge patches that break 2.7.x. Due to that I'm sure
    there are a lot of 2.7.x installations out there that have a 4.x version of
    stdlib installed. That's going to cause a rather rude surprise if some future
    version of 4.x stops working where a prior minor release was functioning.

    I'd like to suggest that the documentation be changed to reflect 4.x supporting
    2.7.x and that a new major version bump is made when 2.7.x support can in fact
    be dropped. An alternative solution would be update the README with a note to
    developers about the kinda/sorta/maybe/fishy/quasi support of 2.7.x.

Please also see this discussion:
https://github.com/puppetlabs/puppetlabs-stdlib/pull/176#issuecomment-30251414

12 years agoMerge pull request #200 from bobtfish/fix_tests_on_osx
Adrien Thebo [Mon, 9 Dec 2013 22:18:17 +0000 (14:18 -0800)]
Merge pull request #200 from bobtfish/fix_tests_on_osx

Fix the tests on osx

12 years ago(#23381) add is_bool() function
Joshua Hoblitt [Mon, 9 Dec 2013 18:45:50 +0000 (11:45 -0700)]
(#23381) add is_bool() function

12 years agoMerge pull request #210 from apenney/temp-fix
Kylo Ginsberg [Sat, 7 Dec 2013 16:48:24 +0000 (08:48 -0800)]
Merge pull request #210 from apenney/temp-fix

Pin rspec-puppet to 0.1.6 for now as the change to 1.0.0 has broken

12 years agoPin rspec-puppet to 0.1.6 for now as the change to 1.0.0 has broken
Ashley Penney [Fri, 6 Dec 2013 23:50:09 +0000 (18:50 -0500)]
Pin rspec-puppet to 0.1.6 for now as the change to 1.0.0 has broken
things involving Mocha badly.

12 years agoAdd rake tasks to validate and lint files and check with Travis
Garrett Honeycutt [Sat, 30 Nov 2013 16:18:43 +0000 (11:18 -0500)]
Add rake tasks to validate and lint files and check with Travis

This patch adds the ability to validate syntax of manifests, templates,
and ruby files in lib/ via `rake validate` and the linting of manifests
with puppet-lint via `rake lint`. These two commands are chained with
running the spec tests in Travis to ensure there are no syntax or style
issues.

12 years agoRemove unintentional link from README
Garrett Honeycutt [Sat, 30 Nov 2013 15:40:27 +0000 (10:40 -0500)]
Remove unintentional link from README

Markdown interprets [] folowed by () as a link, which was a 404 and not
the intention of the original author. This patch ensures that the
document reads as intended, without the link.

12 years agocalling rspec directly makes this not pass ruby -c. adjusting to be in line with...
Tristan Smith [Thu, 21 Nov 2013 02:30:46 +0000 (18:30 -0800)]
calling rspec directly makes this not pass ruby -c. adjusting to be in line with the rest.

12 years agoFix the tests on osx
Tomas Doran [Tue, 19 Nov 2013 18:42:19 +0000 (18:42 +0000)]
Fix the tests on osx

12 years agoMerge branch 'fix/master/add_recursive_merge'
Josh Partlow [Tue, 29 Oct 2013 19:15:42 +0000 (12:15 -0700)]
Merge branch 'fix/master/add_recursive_merge'

* fix/master/add_recursive_merge:
  (#20200) Add a recursive merge function.

Closes GH-189

This patch changes the original pull request to draw in the overlay function as
a Proc and make use of Hash.merge {} for resolving key conflicts.

12 years ago(#20200) Add a recursive merge function.
Justin Burnham [Tue, 24 Sep 2013 17:57:15 +0000 (10:57 -0700)]
(#20200) Add a recursive merge function.

Issue #20200 notes that the merge function does not
support nested hashes.

To prevent unintended side effects with changing merge,
add a deep_merge function instead.

12 years agoMerge branch 'fix-pick-error-typo'
Josh Cooper [Tue, 29 Oct 2013 19:01:39 +0000 (12:01 -0700)]
Merge branch 'fix-pick-error-typo'

* fix-pick-error-typo:
  (Main) fix typo in pick error message

Closes GH-197

12 years ago(Main) fix typo in pick error message
Matthew Haughton [Tue, 29 Oct 2013 18:21:03 +0000 (14:21 -0400)]
(Main) fix typo in pick error message

Update pick error message "at least one non empty value"

12 years agoMerge remote-tracking branch 'tchaudhri/tchaudhri_join_func_doc_typo'
Josh Cooper [Tue, 29 Oct 2013 18:10:12 +0000 (11:10 -0700)]
Merge remote-tracking branch 'tchaudhri/tchaudhri_join_func_doc_typo'

* tchaudhri/tchaudhri_join_func_doc_typo:
  Fixed 'separator' typos

Closes GH-196

12 years agoFixed 'separator' typos
Tehmasp Chaudhri [Fri, 25 Oct 2013 21:26:21 +0000 (15:26 -0600)]
Fixed 'separator' typos

12 years agoMerge branch 'pull-180'
Adrien Thebo [Thu, 19 Sep 2013 04:56:16 +0000 (21:56 -0700)]
Merge branch 'pull-180'

This closes GH-180

12 years ago(maint) Simplify validate_cmd specs
Adrien Thebo [Thu, 19 Sep 2013 04:48:45 +0000 (21:48 -0700)]
(maint) Simplify validate_cmd specs

12 years ago(#22214): close content file before executing checkscript
sgzijl [Mon, 9 Sep 2013 14:20:36 +0000 (16:20 +0200)]
(#22214): close content file before executing checkscript

Right now validation seems to be done against zero byte generated temp
files. We need to close the file before executing validation against it.

12 years agoMerge pull request #184 from lmello/fix_bug_20681_delete_undef_values
Adrien Thebo [Wed, 18 Sep 2013 17:08:49 +0000 (10:08 -0700)]
Merge pull request #184 from lmello/fix_bug_20681_delete_undef_values

delete_undef_values function fix bug #20681

12 years ago(#20681) fix behaviour of delete_undef_values
Leonardo Rodrigues de Mello [Mon, 16 Sep 2013 14:08:13 +0000 (11:08 -0300)]
(#20681) fix behaviour of delete_undef_values

The issue #20681 describe the error of delete() function
removing the elements from the origin array/hash/string.

This issue affected other delete functions. Because
ruby delete and delete_if functions make destructive
changes to the origin array/hash.

The delete_undef_values removed elements from the
origin array/hash and this is not the desired behaviour.

To solve this, we should dup or clone the array/hash
before using the delete or delete_if ruby functions.

We should also check if args[0] is not nil before using
dup, since dup on nil raises exception.

This fix the problem and add unit tests, so we could
enforce this behaviour and prevent regressions.

12 years agoMerge pull request #183 from lmello/fix_bug_20681_delete_at
Adrien Thebo [Tue, 17 Sep 2013 18:39:29 +0000 (11:39 -0700)]
Merge pull request #183 from lmello/fix_bug_20681_delete_at

delete_at added spec to check against bug #20681

12 years agoMerge pull request #182 from lmello/fix_bug_20681_delete_values
Adrien Thebo [Tue, 17 Sep 2013 18:35:57 +0000 (11:35 -0700)]
Merge pull request #182 from lmello/fix_bug_20681_delete_values

delete_values() fix bug #20681.

12 years agoMerge pull request #185 from lmello/refactor_16498
Adrien Thebo [Tue, 17 Sep 2013 18:33:57 +0000 (11:33 -0700)]
Merge pull request #185 from lmello/refactor_16498

(#16498) Added unit test for loadyaml function.

12 years ago(#16498) Added unit test for loadyaml function.
Leonardo Rodrigues de Mello [Tue, 17 Sep 2013 14:10:00 +0000 (11:10 -0300)]
(#16498) Added unit test for loadyaml function.

As stated on the issue #16498, it would be great to have unit tests
for all the functions.

Function loadyaml was missing a unit test. This commit added the
unit test to loadyaml function.

12 years agoMerge pull request #178 from lmello/fix_bug_20681
Adrien Thebo [Tue, 17 Sep 2013 18:07:21 +0000 (11:07 -0700)]
Merge pull request #178 from lmello/fix_bug_20681

 bug # 20681 delete() function should not remove elements from original list

12 years ago(#20681) delete_at function unit test against issue
Leonardo Rodrigues de Mello [Mon, 16 Sep 2013 13:51:15 +0000 (10:51 -0300)]
(#20681) delete_at function unit test against issue

The issue #20681 describe the error of delete() function
removing the elements from the origin array/hash/string.

This issue affected the other delete functions.

The delete_at function is not afected by this bug, but
it did not had the unit test to check against it.

I had added the unit test so we could prevent regressions
on the future and also have better test coverage.

12 years ago(#20681) fix behaviour of delete_values
Leonardo Rodrigues de Mello [Mon, 16 Sep 2013 13:33:58 +0000 (10:33 -0300)]
(#20681) fix behaviour of delete_values

The issue #20681 describe the error of delete() function
removing the elements from the origin array/hash/string.

This issue affected other delete functions. Because
ruby delete and delete_if functions make destructive
changes to the origin array/hash.

The delete_undef_values removed elements from the
origin hash and this is not the desired behaviour.

To solve this, we should dup or clone the hash
before using the delete or delete_if ruby functions.

This fix the problem and add unit tests, so we could
enforce this behaviour and prevent regressions.

12 years agoMerge pull request #179 from lmello/function_pick_error_msg
Adrien Thebo [Mon, 16 Sep 2013 20:45:24 +0000 (13:45 -0700)]
Merge pull request #179 from lmello/function_pick_error_msg

enhanced the error message of pick function.

12 years agobug # 20681 delete() function should not remove elements from original list
Leonardo Rodrigues de Mello [Mon, 9 Sep 2013 13:27:54 +0000 (10:27 -0300)]
bug # 20681 delete() function should not remove elements from original list

The setup: list with 3 elements, delete one:
$test_list = [‘a’, ‘b’, ‘c’]
$test_deleted = delete($test_list, ‘a’)

Print out the elements in ‘test_deleted’:
notify { ‘group_output2’:  withpath => true, name     => “$cfeng::test_deleted”, }
Notice: /Stage[main]/Syslog/Notify[group_output2]/message: bc

Good!  Run-on output shows that ‘a’ was deleted

Print out the elements in ‘test_list’:
notify { ‘group_output1’: withpath => true, name     => “$cfeng::test_list”, }
Notice: /Stage[main]/Syslog/Notify[group_output1]/message: bc

WHAT!?  'a' was deleted from ‘test_list’ as well! Expected abc as output!

This behaviour is confirmed for string, hash and array.
This is fixed on this commit, I had  added two spec tests to cover that cases.

bug #20681 spec test for delete() function.

I had forgot in the last commit the spec test for hash in the
delete function.

bug # 20681 delete() function change aproach.

Instead of rejecting elements from the original list, we use
collection = arguments[0].dup .
then latter we could continue to use delete and gsub! on collection
without impact on original argument.

this is a better solution than the previous one, and works on ruby
1.8.7, 1.9.3 and 2.0.0.

The previous solution does not work on ruby 1.8.7.

delete function remove typo whitespace.

fix typo whitespaces.

12 years agoenhanced the error message of pick function.
Leonardo Rodrigues de Mello [Fri, 6 Sep 2013 13:53:47 +0000 (10:53 -0300)]
enhanced the error message of pick function.

When pick function fail return a better error message like
the other stdlib functions, indicating that the error
is on function pick.

This would help people that see the error to identity it is
related to a incorrect use of stdlib function pick, instead of having
to grep all puppet libraries and manifests source for the old message.

I had also changed the spec test.

pick function change spec  as suggested GH-179

Fix the spec test to use expect {}.to instead of lambda {}.should
as explained by Adrienthebo.

"Using expect { }.to is preferred over lambda { }.should.
 In addition it's best practice to do a string match against the
error message to ensure that we're catching the right error,
instead of any error of the right type."

Also fixed a typo on the error message, it was missing one space.

pick function stylish fix as suggested on GH179

12 years agoMerge pull request #181 from nibalizer/grammar
Adrien Thebo [Thu, 12 Sep 2013 16:57:28 +0000 (09:57 -0700)]
Merge pull request #181 from nibalizer/grammar

Minor grammar fix

12 years agoMinor grammar fix
Spencer Krum [Wed, 11 Sep 2013 22:37:59 +0000 (15:37 -0700)]
Minor grammar fix

12 years agoMerge pull request #175 from floatingatoll/patch-1
Adrien Thebo [Wed, 11 Sep 2013 18:13:28 +0000 (11:13 -0700)]
Merge pull request #175 from floatingatoll/patch-1

(maint) fix RST formatting of has_interface_with code examples

12 years agoMerge pull request #174 from dprince/file_line_after
Adrien Thebo [Mon, 9 Sep 2013 18:17:16 +0000 (11:17 -0700)]
Merge pull request #174 from dprince/file_line_after

Update file_line resource to support 'after'.

12 years ago(maint) fix RST formatting of has_interface_with code examples
floatingatoll [Wed, 4 Sep 2013 17:26:14 +0000 (10:26 -0700)]
(maint) fix RST formatting of has_interface_with code examples

12 years ago(maint) Improve the tests and readability of file_line
Jeff McCune [Thu, 29 Aug 2013 23:27:27 +0000 (16:27 -0700)]
(maint) Improve the tests and readability of file_line

Without this patch the implementation of the file_line provider is a bit
convoluted with respect to the newly introduced "after" parameter.

This patch addresses the problem by separating out the concerns of each
case into their own methods of handling the behavior with the match
parameter, handling the behavior with the after parameter, or simply
appending the line.

12 years agoUpdate file_line resource to support 'after'.
Dan Prince [Thu, 29 Aug 2013 16:19:16 +0000 (12:19 -0400)]
Update file_line resource to support 'after'.

When adding new lines to a file the 'after' option can be useful
when you need to insert file lines into the middle of a file.

This is particularly helpful when using file_line with sectioned
config files.

NOTE: the after option only works when adding new lines. If you are
updating an existing (matched) line it will simply modify it in place.
This assumes it was in the right place to begin with.