Better way (without executing a process):

$new_ip=inline_template("<%= Resolv::DNS.new.getaddress('www.ru').to_s -%>")

or may be simple $ipaddress fact is suitable for you?

On Monday, March 5, 2012 6:22:29 PM UTC+4, pablo.f...@cscs.ch wrote:
>
>  Hi,
>
>  
>
> > Try using %x{} instead of system. The system() function returns the
>
> > return code of the process, not the output.
>
>  
>
> > irb> %x{hostname --fqdn}.chomp
>
> > => "dagon.fnord.no"
>
>  
>
> That worked, thanks!
>
>  
>
> For the record, this is how it looks like:
>
>  
>
> $new_ip=inline_template("<%= %x{host $hostname|awk '{print \$4}'}.chomp 
> %>")
>
> notify { "New IP: $new_ip": }
>
>  
>
> Kind regards,
>
> Pablo
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/80554ee1-eff9-414f-89ae-a5714c655f29%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to