Update stdlib
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / has_ip_address.rb
1 #
2 # has_ip_address
3 #
4
5 module Puppet::Parser::Functions
6   newfunction(:has_ip_address, :type => :rvalue, :doc => <<-EOS
7 Returns true if the client has the requested IP address on some interface.
8
9 This function iterates through the 'interfaces' fact and checks the
10 'ipaddress_IFACE' facts, performing a simple string comparison.
11     EOS
12   ) do |args|
13
14     raise(Puppet::ParseError, "has_ip_address(): Wrong number of arguments given (#{args.size} for 1)") if args.size != 1
15
16     Puppet::Parser::Functions.autoloader.load(:has_interface_with) \
17       unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with)
18
19     function_has_interface_with(['ipaddress', args[0]])
20
21   end
22 end
23
24 # vim:sts=2 sw=2