Sorry, rushing around on trains. Try this:
irb(main):002:0> require 'resolv'
=> true
irb(main):003:0> Resolv.new.getname('127.0.0.1')
=> "localhost"
On Thu, Nov 26, 2015 at 7:54 AM, Denmat <[email protected]> wrote:
> Sorry, ignore my suggestion. That won't work.
>
> On 26 Nov 2015, at 06:57, Dayton Jones <[email protected]> wrote:
>
> I'm writing a template to populate a file - easy enough...
>
> What I want is to to grab the list of interfaces, get the ip assigned to
> that interface and then do a lookup of the ip to get the dns name.
>
> I'm able to get the interfaces/ips just fine, but can't figure out how to
> then pass the IP to the function to do the lookup. Any help is greatly
> appreciated...
>
> =======================
> start ERB
>
> <% scope.lookupvar('interfaces').split(",").each do |interface| %>
> <% @int_ip = scope.lookupvar('ipaddress_'+interface) %>
> <% @int_name = Resolv.new.getname @int_ip %>
> ...
> <% end %>
>
> end ERB
> ========================
>
> @int_ip gets popluated and I can manipulate it as needed, but how do I
> properly pass it to 'Resolv.new.getname' to set the int_name string?
>
> --
> 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/6bf51a8e-eb7f-4bcd-ac77-2451bcbec5ce%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/6bf51a8e-eb7f-4bcd-ac77-2451bcbec5ce%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
--
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/CAJsPER2DYP5ma%2B_KUA8FA1rxKZBfm%3DWWyyhZ%2BZV%2B%3DApnU-cjbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.