puppetlabs-stdlib/spec/unit/puppet/parser/functions
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
..
abs_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
bool2num_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
capitalize_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
chomp_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
chop_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
delete_at_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
delete_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
downcase_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
empty_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
flatten_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
fqdn_rotate_spec.rb (Maint) use PuppetlabsSpec::PuppetInternals.scope (master) 2012-08-10 11:54:44 -07:00
get_module_path_spec.rb (Maint) Don't mock with mocha 2012-07-23 15:47:51 -07:00
getvar_spec.rb (Maint) Fix mis-use of rvalue functions as statements 2012-08-20 13:57:09 -07:00
grep_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
has_interface_with_spec.rb (#13974) Add predicate functions for interface facts 2012-11-07 14:00:44 -08:00
has_ip_address_spec.rb (#13974) Add predicate functions for interface facts 2012-11-07 14:00:44 -08:00
has_ip_network_spec.rb (#13974) Add predicate functions for interface facts 2012-11-07 14:00:44 -08:00
has_key_spec.rb (Maint) Fix mis-use of rvalue functions as statements 2012-08-20 13:57:09 -07:00
hash_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
is_array_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
is_domain_name_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
is_float_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
is_hash_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
is_integer_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
is_ip_address_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
is_mac_address_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
is_numeric_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
is_string_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
join_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
keys_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
lstrip_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
member_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
merge_spec.rb Merge branch '2.1.x' into 2.2.x 2012-08-20 14:03:48 -07:00
num2bool_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
parsejson_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
parseyaml_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
prefix_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
range_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
reverse_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
rstrip_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
shuffle_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
size_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
sort_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
squeeze_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
str2bool_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
str2saltedsha512_spec.rb (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope (2.3.x) 2012-07-23 09:13:08 -07:00
strftime_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
strip_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
swapcase_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
time_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
to_bytes_spec.rb (#15872) Add to_bytes function 2012-08-14 08:43:36 -07:00
type_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
unique_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
upcase_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
uriescape_spec.rb Add function, uriescape, to URI.escape strings. Redmine #17459 2012-11-07 09:36:54 -08:00
validate_absolute_path_spec.rb Make sure functions are loaded for each test 2012-08-09 14:51:37 -07:00
validate_array_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
validate_bool_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
validate_hash_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
validate_re_spec.rb Make sure functions are loaded for each test 2012-08-09 14:51:37 -07:00
validate_slength_spec.rb (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope (2.3.x) 2012-07-23 09:13:08 -07:00
validate_string_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
values_at_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
values_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00
zip_spec.rb (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} 2012-07-23 08:35:00 -07:00