From 97e15ea5a84bf414529e110a4215d9fe7f9f20e0 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 31 Oct 2009 15:16:37 +0100 Subject: move plugin directory to fit new 0.25 style --- lib/puppet/parser/functions/hostname.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lib/puppet/parser/functions/hostname.rb (limited to 'lib/puppet/parser/functions/hostname.rb') diff --git a/lib/puppet/parser/functions/hostname.rb b/lib/puppet/parser/functions/hostname.rb new file mode 100644 index 0000000..7bc477f --- /dev/null +++ b/lib/puppet/parser/functions/hostname.rb @@ -0,0 +1,13 @@ +# get an uniq array of ipaddresses for a hostname +require 'resolv' + +module Puppet::Parser::Functions + newfunction(:hostname, :type => :rvalue) do |args| + res = Array.new + Resolv::DNS.new.each_address(args[0]){ |addr| + res << addr + } + res.uniq + end +end + -- cgit v1.2.3