Mark Chappell [Tue, 22 Apr 2014 07:36:28 +0000 (09:36 +0200)]
(MODULES-707) chomp() fails because generate() no longer returns a string
We need to use
unless value.is_a?(String) || value.is_a?(Array)
rather than
klass = value.class
unless [String, Array].include?(klass)
because the klass version enforces type checking which is too strict, and does
not allow us to accept objects wich have extended String (or Array).
For example, generate() function now returns Puppet::Util::Execution::ProcessOutput
which is just a very simple extension of String. While this in it's self was
not intentional (PUP-2306) it is not unreasonable to cope with objects which
extend Strings
Spencer Krum [Wed, 20 Nov 2013 04:11:08 +0000 (20:11 -0800)]
Introduce test for array destruction
It was discovered that the concat array modifies the arrays passed to it
as an argument as a side effect. This test will ensure that doesn't
happen again.
Hunter Haugen [Fri, 27 Jun 2014 19:30:27 +0000 (12:30 -0700)]
Release 4.3.0
Summary:
This release is the first supported release of the stdlib 4 series. It
emains backwards-compatible with the stdlib 3 series. It adds two new
unctions, one bugfix, and many testin
Features:
- New `bool2str()` function
- New `camalcase()` function
Bugfixes:
- Fix `has_interface_with()` when interfaces fact is nil
Hunter Haugen [Thu, 19 Jun 2014 22:38:23 +0000 (15:38 -0700)]
(FM-1587) Fix test issues on solaris 10
- ensure_packages fails because Error: Sun packages must specify a package source
- ensure_resource fails for the same reason
- get_module_path fails because the modulepath is different
- has_interface_with fails because the interface is lo0 not lo
Ryan McKern [Thu, 15 May 2014 22:01:14 +0000 (15:01 -0700)]
(MODULES-905) Narrow the confinement in bool2str
Previously, bool2str() accepted a broad array of boolean values and
bare strings, without any attempt to validate that the strings in any
way resembled "true" or "false" (or any of the other values bool2num()
accepts). This commit narrows the input confinement to TrueClass and
FalseClass, which means that bool2str() will only interpolate
strict boolean values now.
Stephen Benjamin [Wed, 14 May 2014 18:33:57 +0000 (20:33 +0200)]
(PUP-2571) add 'before' functionality to file_line
file_line supports adding lines after a match, but there are use cases when
having "before" would be useful. For example, in Debian-based OS's, the last
line of /etc/rc.local is "exit 0" it's an incredible pain to deal with
that scenario today.
This commit adds a 'before' parameter to the file_line type, and implements
it for the ruby provider.
Ryan McKern [Tue, 13 May 2014 22:01:44 +0000 (15:01 -0700)]
(MODULES-905) Add bool2str() and camelcase() for string manipulation
Python likes to have its constants Capitalized, and the capitalize
function only understands strings... so I shave a yak.
bool2str will convert a boolean to its equivalent string value,
and camelcase extends on uppercase & downcase to convert an underscore
delimited string into a camelcased string.
Hunter Haugen [Thu, 8 May 2014 22:18:36 +0000 (15:18 -0700)]
Release - 4.2.0
Summary
========
This release adds many new functions and fixes, and continues to be backwards compatible with stdlib 3.x
Features
-------
- New `base64()` function
- New `deep_merge()` function
- New `delete_undef_values()` function
- New `delete_values()` function
- New `difference()` function
- New `intersection()` function
- New `is_bool()` function
- New `pick_default()` function
- New `union()` function
- New `validate_ipv4_address` function
- New `validate_ipv6_address` function
- Update `ensure_packages()` to take an option hash as a second parameter.
- Update `range()` to take an optional third argument for range step
- Update `validate_slength()` to take an optional third argument for minimum length
- Update `file_line` resource to take `after` and `multiple` attributes
Bugfixes
--------
- Correct `is_string`, `is_domain_name`, `is_array`, `is_float`, and `is_function_available` for parsing odd types such as bools and hashes.
- Allow facts.d facts to contain `=` in the value
- Fix `root_home` fact on darwin systems
- Fix `concat()` to work with a second non-array argument
- Fix `floor()` to work with integer strings
- Fix `is_integer()` to return true if passed integer strings
- Fix `is_numeric()` to return true if passed integer strings
- Fix `merge()` to work with empty strings
- Fix `pick()` to raise the correct error type
- Fix `uriescape()` to use the default URI.escape list
- Add/update unit & acceptance tests.
Hunter Haugen [Thu, 8 May 2014 17:47:24 +0000 (10:47 -0700)]
Move unit tests to spec/functions
rspec-puppet matchers are defined for tests which exist in
spec/functions, but the function unit tests lived in
spec/unit/puppet/parser/functions. This moves them to the correct place
for using rspec-puppet