Re: [Puppet Users] Running command in server

2013-12-19 Thread zed_0xff
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.

Re: [Puppet Users] Running command in server

2012-03-05 Thread Pablo Fernandez
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 '

Re: [Puppet Users] Running command in server

2012-03-05 Thread Stig Sandbeck Mathisen
"pablo.fernan...@cscs.ch" writes: > Do you know what am I doing wrong? How do I capture the system() > output? Try using %x{} instead of system. The system() function returns the return code of the process, not the output. Oh, and "chomp" the extra whitespace off the output. If you're new to r

[Puppet Users] Running command in server

2012-03-05 Thread pablo.fernan...@cscs.ch
Dear Puppet users, I'm quite new to Puppet, and I know less about ruby. That's probably why I have this question, hopefully you could answer it. I have google'd quite a lot about it, without success: I install nodes on a private subnet, and they get their FQDN from a local DHCP server, so the $ho