Age | Commit message (Collapse) | Author |
|
|
|
This is a partial backport and update of 03c5c4a434c2290c021034dbfed82cb0f97e0e87
to add travis-ci support and a Gemfile to 2.x. Right now we're not
testing 2.x in travis-ci and we're experiencing spec failures because we
have to install rspec-puppet from git. The best resolution for this is
to consistently use a Gemfile for running tests.
This commit also rewrites the .travis.yml for 2.x to only test 2.x
versions against ruby 1.8.7 and Puppet < 3.0
Conflicts:
.travis.yml
|
|
|
|
Puppet passes numbers as String to functions, but it makes more sense to
compare them as Numeric.
But sometimes Puppet passes them as the wrong type, see:
https://projects.puppetlabs.com/issues/19812
|
|
|
|
|
|
|
|
The function only uses the first argument, so raise an error with
too few arguments *and* with too many arguments.
|
|
* mhellmic-2.x:
changed .count to .size to support legacy ruby
|
|
|
|
|
|
* duritong-fun/2.x/reject:
Add reject() function
|
|
Like the grep function, but we can now reject members of an array
based on a pattern.
|
|
This reverts commit dbe3c8ecf6379963f583ea11e51e403e5ad55002.
Because testing these against Puppet 2.6.x is causing failures. These
need to be cleaned up, but I want to leave and this was the behavior
before I tried to "fix" it.
|
|
* metcalfc/2.x/ensure_packages:
(Maint) Add spec/functions to rake test task
Add example behaviors for ensure_packages() function
Add an ensure_packages function.
|
|
Without this patch the `test` rake task does not exercise the
rspec-puppet behaviors located in spec/functions/ This is a
self-evident problem.
This patch fixes the problem by adding spec/functions to the list of
directories scanned for spec tests.
|
|
Without this patch the ensure_packages() function has no rspec behavior
examples. This patch fixes the problem by filling out a spec file with
expected behaviors I could think of.
|
|
Its often the case that modules need to install a handful of packages.
In some cases its worth breaking these dependencies out into their own
modules (e.g., Java). In others it makes more sense to keep them in the
module. This can be problematic when multiple modules depend on common
packages (git, python ruby, etc). ensure_resource was a good first step
towards solving this problem. ensure_resource does not handle arrays and
for 3 or more packages stamping out ensure_resource declarations is
tedious.
ensure_packages is a convenience function that takes an array of packages
and wraps calls to ensure_resource. Currently users cannot specify
package versions. But the function could be extended to use a hash if
that functionality would be useful.
|
|
* fun/2.x/min_max:
(#17797) min() and max() functions
|
|
returns the min or max of all arguments given to them
|
|
* fun/2.x/14670_file_line_autorequire:
(#14670) Fixup file_line autorequire specs
(#14670) autorequire a file_line resource's path
|
|
Without this patch applied the file_line autorequire examples are
failing. This is a problem because the failures are false positives and
should be passing given the implementation.
This patch fixes the problem by changing the examples to directly test
the existence of the relationship by finding it in the list of
autorequire relationships.
|
|
If we manage a file we edit with file_line, it should be autorequired by
file_line. Without this patch applied the relationship is not
automatically setup and the user is forced to manually manage the
relationship.
|
|
* lifton-feature/2.x/join_keys_to_values_function:
Add join_keys_to_values function
|
|
This commit adds a function that joins each of a hash's keys with that
key's corresponding value, separated by a separator string. The
arguments are a hash and separator string. The return value is an
array of joined key/value pairs.
|
|
* lifton-feature/2.x/extend_delete_function:
Extend delete function for strings and hashes
Fixed typo
|
|
Previous to this commit, the delete function only acted on
arrays. This commit adds the same functionality for hashes and strings
in the obvious way: delete(h, k) would delete the k key from the h
hash and delete(s, sub) would delete all instances of the sub
substring from the s string.
|
|
|
|
* feature/2.x/pick:
Add the pick() function
|
|
This function is similar to a coalesce function in SQL in that it will
return
the first value in a list of values that is not undefined or an empty
string
(two things in Puppet that will return a boolean false value).
Typically,
this function is used to check for a value in the Puppet
Dashboard/Enterprise
Console, and failover to a default value like the following:
$real_jenkins_version = pick($::jenkins_version, '1.449')
The value of $real_jenkins_version will first look for a top-scope
variable
called 'jenkins_version' (note that parameters set in the Puppet
Dashboard/
Enterprise Console are brought into Puppet as top-scope variables), and,
failing that, will use a default value of 1.449.
|
|
* add/2.x/13974-has_interface_with:
(#13974) Add predicate functions for interface facts
|
|
If one wishes to test if a host has a particular IP address (such as a floating
virtual address) or has an interface on a particular network (such as a
secondary management network), the facts that provide this information are
difficult to use within Puppet.
This patch addresses these needs by implementing functions
‘has_ip_address(value)’ and ‘has_ip_network(value)’. These functions look
through all interfaces for ipaddress_<interface> and network_<interface>
(respectively) having the requested <value>.
These functions are implemented on top of a lower-level predicate
function, ‘has_interface_with(kind, value)’, which iterates through the
interfaces in the ‘interfaces’ fact and checks the facts <kind>_<interface>
looking for <value>.
Additionally, the existence of a particular named interface can be checked for
by calling with only a single argument: has_interface_with(interface).
A Boolean is returned in all cases.
|
|
* add/2.x/joejulian-add_uriescape:
Add function, uriescape, to URI.escape strings. Redmine #17459
|
|
|
|
* 2.5.x:
Update Modulefile, CHANGELOG for 2.5.1
|
|
|
|
* 2.5.x:
(maint) Fix spec failures resulting from Facter API changes
|
|
* fix/2.5.x/facter_loader:
(maint) Fix spec failures resulting from Facter API changes
|
|
Without this patch stdlib tests fail against Facter 2.x and master but
not 1.6.x.
This patch fixes the problem by initializing the example group
differently depending on the version of Facter integrating into the
system. The adjusted methods are:
1.x - Facter.collection.loader.load
2.x - Facter.collection.load
The collection actually implements the load method in both version, it's
simply marked as private in 1.x.
|
|
|
|
* maint/2.5.x/pick_compatible_new_functionality:
Explicitly load functions used by ensure_resource
re-formatting
Add better docs about duplicate resource failures
Handle undef for parameter argument
Add function ensure_resource and defined_with_params
|
|
maint/2.5.x/pick_compatible_new_functionality
* maint/2.5.x/pick_explicitly_load_functions:
Explicitly load functions used by ensure_resource
|
|
The ensure_resource function actually calls two
other functions, create_resources and defined_with_param.
When calling Puppet functions from Ruby, you sometimes have
to load the functions manually if they have not been called
before.
This commit explicitly loads the functions that ensure_resource
depends on from within the function.
|
|
maint/2.5.x/pick_compatible_new_functionality
* maint/2.5.x/pick_pr86_ensure_resource:
re-formatting
Add better docs about duplicate resource failures
Handle undef for parameter argument
Add function ensure_resource and defined_with_params
|
|
This commit refactors to ensure 80 character lines.
|
|
This commit adds better inline documentation
explaining how replicate resource definitions can
occur if the resource exists and does not have
matching parameters.
|
|
This commit adds better handling of the case where
undef is passed as the parameter value.
This works by converting '' into []
|
|
This commit adds 2 new functions with unit tests.
defined_with_params works similarily to puppet's defined
function, except it allows you to also specify a hash of
params. defined_with_params will return true if a resource
also exists that matches the specified type/title (just like
with defined) as well as all of the specified params.
ensure_resource is a function that basically combines defined_with_params
with create_resources to conditionally create resources only if the
specified resource (title, type, params) does not already exist.
These functions are created to serve as an alternative to using
defined as follows:
if ! defined(Package['some_package']) {
package { 'some_package': ensure => present,
}
The issue with this usage is that there is no guarentee about
what parameters were set in the previous definition of the package
that made its way into the catalog.
ensure_resource could be used instead, as:
ensure_resource('package', 'some_package', { 'ensure' => 'present' })
This will creat the package resources only if another resource does
not exist with the specified parameters.
|
|
This reverts commit d6d23b495cda0e154b4e73982acc43e586564c0e.
This backwards-compatible additional functionality is targeted at the
next minor release. There are already backwards-incompatible changes in
the master branch so we need to establish a new minor branch.
|
|
This reverts commit 74e6411157b8df1af9a24c17971e3236f3096529, reversing
changes made to 417d219aa6e42f2a16af42c98aa063fc1d9d2ecd.
Here's why:
Actually... I just screwed this up.
I merged this new fact into 2.4.x but it's not fixing any bug. It's adding a
new fact, so this should go into master and we should release 2.5 since this is
new, backwards-compatible functionality.
|