On 11-02-09 01:01 AM, Naresh V wrote:
> Facter.add(:ipaddress, :timeout => 2) do
>     setcode do
>         if hostname = Facter.value(:hostname)
>             # we need Hostname to exist for this to work
>             host = nil
>             if host = Facter::Util::Resolution.exec("host #{hostname}")
>                 list = host.chomp.split(/\s/)
>                 if defined? list[-1] and
>                         list[-1] =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/
>                     list[-1]
>                 end
>             else
>                 nil
>             end
>         else
>             nil
>         end
>     end
> end

> If this part were the default/first piece of code that'd be used to
> produce the ipaddress fact, setting the right A record for the fqdn
> should solve the problem?

hmm this fact looks like it won't work for any host that doesn't
resolve, which would be problematic for something like a test setup with
virtual machines.

-- 
Gabriel Filion

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to