Commit graph

8 commits

Author SHA1 Message Date
Jeff McCune
a45d4f1307 Revert "Merge pull request #130 from jhoblitt/has_element"
This reverts commit f7a18189ec, reversing
changes made to 36a7b29630.

I'm reverting this change because of concerns raised by Peter Meier that
it duplicates the "in" operator in the DSL.  The "in" operator is new
information that I did not posses when I made the decision to merge.
Because of this new information I'm un-merging and continuing the
discussion in the comments of
https://projects.puppetlabs.com/issues/19272

Reference: GH-130
2013-02-15 11:57:42 -08:00
Joshua Hoblitt
95cf3fed68 (#19272) Add has_element() function
It is exceptionally difficult to determine if an array contains an element matching a specific value without an iteration or loop construct.

This function is the Puppet equivalent of Array.includes?(foo) in Ruby.  The implementation is a verbatim copy of has_key() with the minor modifications needed to support arrays instead of hashes.
2013-02-14 12:06:21 -07:00
Erik Dalén
7742e5f447 maint: style guideline fixes 2012-11-30 11:02:02 +01:00
Wil Cooley
f8194176dc (#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.
2012-11-07 14:00:44 -08:00
Jeff McCune
f3c53e6f19 (#8792) Rename basic smoke test to reflect file_line rename
Without this patch the basic smoke test in the module tests/ directory
did not math up with the renamed whole_line => file_line resource type.

This patch updates the smoke test file to match the most recently
selected name of file_line.  The filename has been changed, comments
added to the smoke test file, and resource declarations inside the file
changed.
2011-08-08 09:33:56 -07:00
Dan Bode
4540949d96 (#8665) Change type from append_line to whole_line
Changed the type name from append_line to
whole_line.

After feedback that having a type with a verb in
the name was confusing.
2011-07-27 15:28:44 -07:00
Dan Bode
e82370a26d (#8628) Add append_line native type
This commit adds a native type that can check if
a line exists and append it to a file.

This use case seems common enough to warrant its
inclusion into stdlib.

Reviewed-by: Jeff McCune
2011-07-26 15:30:28 -07:00
Jeff McCune
6e9d0465bc Initial commit 2011-05-24 11:06:30 -07:00