Mark Rosedale
2014-Oct-02 17:23 UTC
[Puppet Users] custom function error undefined local variable
I have the following custom function that I'm trying to write. require 'resolv' module Puppet::Parser::Functions newfunction(:getIpAddr, :type => :rvalue) do |arguments| Resolv::DNS.open do |dns| ress = dns.getresources(arguments[0], Resolv::DNS::Resource::IN::A) if ress.any? dns.getaddress(arguments[0]) #break else raise(Puppet::ParseError, "No valid A Record found for host #{aguments[0]}") end end #return value end end I'm getting the following error when I run this function. Error: Could not retrieve catalog from remote server: Error 400 on SERVER: undefined local variable or method `dns' for #<Puppet::Parser::Scope:0x7f5054f07110> at -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/02de838d-6cb2-495a-883d-98fb15782df9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.