This patch addresses the problem by explicitly returning an empty string if the
string itself is empty. This avoids trying to convert an empty string to a
symbol which is the root cause of the problem.
Jaka Hudoklin [Wed, 2 Jan 2013 12:10:43 +0000 (12:10 +0000)]
Add getparam function to get defined resource parameters
As far as i know there's no other puppet-dsl-like way to get parameter of
defined resource, so that's why i implemented getparam function, which takes
resource reference and parameter name and returns parameter value.
Here's another example why this function is really useful:
Jeff McCune [Mon, 7 Jan 2013 22:48:30 +0000 (14:48 -0800)]
(maint) Update puppet version in Travis configuration
Without this patch we'll test against all Puppet 3.0 versions, but not
4. This is a problem because the travis configuration should be
relatively future proof to minimize surprises.
This patch addresses the problem by using >= instead of ~> in the
dependency specification. The patch also combines two different
notification sections into a single entry.
Jeff McCune [Mon, 7 Jan 2013 02:45:43 +0000 (18:45 -0800)]
Tell Travis CI to notify the PDC WebHook
Without this patch the so-called "puppet development community" hook
service isn't being notified when Travis CI accepts jobs. This is a
problem because we want the ability for Travis Bot to comment on pull
requests as a result of CI build results. For example, if the build
fails, then Gepetto Bot could make some helpful suggestions on how to
re-run the build by amending a commit and force-pushing the branch.
This patch uses the notifications section of the travis.yml
configuration file, as documented at:
http://about.travis-ci.org/docs/user/notifications/#Webhook-notification
Jeff McCune [Sun, 6 Jan 2013 05:11:53 +0000 (21:11 -0800)]
Future proof travis build matrix
Without this patch we're not building against ruby head. This is a
problem because we need to know if standard lib works with the latest
version of MRI.
This patch builds against ruby head but also allows the build to pass if
there are failures with ruby-head.
Jeff McCune [Sat, 5 Jan 2013 23:01:56 +0000 (15:01 -0800)]
(maint) Add Travis CI Support
Without this patch stdlib has Travis CI configuration files, but they
don't seem to completely specify the dependency versions and the build
matrix. This patch addresses the problem by putting the dependency
information in the conventional Gemfile location.
This patch should coincide with enabling Travis CI support for pull
requests. A build status image is also included in the project README.
Jeff McCune [Thu, 3 Jan 2013 21:39:42 +0000 (13:39 -0800)]
Merge branch '4.x'
* 4.x:
Add test/validation for is_float if created from an arithmetical operation
Add test/validation for is_integer if created from an arithmetical operation
Add test/validation for is_numeric if created from an arithmetical operation
Jeff McCune [Thu, 3 Jan 2013 21:39:05 +0000 (13:39 -0800)]
Merge branch '3.x' into 4.x
* 3.x:
Add test/validation for is_float if created from an arithmetical operation
Add test/validation for is_integer if created from an arithmetical operation
Add test/validation for is_numeric if created from an arithmetical operation
Jeff McCune [Thu, 3 Jan 2013 21:38:36 +0000 (13:38 -0800)]
Merge branch '3.2.x' into 3.x
* 3.2.x:
Add test/validation for is_float if created from an arithmetical operation
Add test/validation for is_integer if created from an arithmetical operation
Add test/validation for is_numeric if created from an arithmetical operation
Jeff McCune [Thu, 3 Jan 2013 21:38:16 +0000 (13:38 -0800)]
Merge branch 'stephenrjohnson-bug/3.x/18157_arithmetical_operations' into 3.2.x
* stephenrjohnson-bug/3.x/18157_arithmetical_operations:
Add test/validation for is_float if created from an arithmetical operation
Add test/validation for is_integer if created from an arithmetical operation
Add test/validation for is_numeric if created from an arithmetical operation
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.
Jeff McCune [Wed, 28 Nov 2012 00:19:52 +0000 (16:19 -0800)]
Merge branch 'metcalfc/2.x/ensure_packages' into 2.x
* 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.
Jeff McCune [Wed, 28 Nov 2012 00:15:32 +0000 (16:15 -0800)]
Add example behaviors for ensure_packages() function
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.
Chad Metcalf [Tue, 18 Sep 2012 18:43:30 +0000 (11:43 -0700)]
Add an ensure_packages function.
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.
Jeff McCune [Mon, 26 Nov 2012 19:37:08 +0000 (11:37 -0800)]
(#14670) Fixup file_line autorequire specs
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.
Peter Meier [Wed, 23 May 2012 19:42:07 +0000 (21:42 +0200)]
(#14670) autorequire a file_line resource's path
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.
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.
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.
Gary Larizza [Fri, 3 Aug 2012 22:46:26 +0000 (15:46 -0700)]
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:
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.
Wil Cooley [Wed, 21 Mar 2012 05:21:53 +0000 (22:21 -0700)]
(#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).