Created
October 10, 2014 06:08
-
-
Save superseb/fdb443e86a8470a276a5 to your computer and use it in GitHub Desktop.
Custom function getipaddr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'resolv' | |
module Puppet::Parser::Functions | |
newfunction(:getIpAddr, :type => :rvalue) do |arguments| | |
result = Resolv.getaddress arguments[0] | |
unless result.nil? | |
result | |
else | |
raise(Puppet::ParseError, "No valid A Record found for host #{arguments[0]}") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment