just guessing, is this a typo: " if ress.any?"
On Thursday, October 2, 2014 10:23:25 AM UTC-7, Mark Rosedale wrote:
>
> 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
>
>
>
On Thursday, October 2, 2014 10:23:25 AM UTC-7, Mark Rosedale wrote:
>
> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/3f5854a3-9cdc-4056-afad-55bcb4b9df28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.