While Matt and I were pairing on getting IPv6 support into facter we
> ran across some code that, on Darwin, would try and DWIM out the
> "main" address of the system. Specifically, it assumed that the
> "main" IP address of a machine was the one associated with a default
> route.
I have recreated this behavior in a custom fact on Linux before and would
support it being declared the correct behavior everywhere.
> I would be inclined to say that we should try and avoid this sort of
> DWIM magic in facts, and handle complaints from users by telling them
> that in complex situations they need to work out their own rules and
> use the appropriate fact by hand. If we needed to, provide extra
> facts like "default route interface" or something that helps support
> them getting this without needing to write custom facts, but also
> without pretending that networks are all comprised of single-homed
> hosts with a single default route.
>
It's really tedious to do anything but hardcode the interface names in these
facts so if efforts to have Puppet DWIM might go away, I'd like this to be
easier:
Facter.add :ipaddress_of_the_interface_i_care_about do
setcode do
result = nil
Facter.value(:interfaces).split(",").each do |interface|
if this_is_the_interface_i_care_about
result = Facter.value("ipaddress_#{interface}")
end
end
result
end
end
Being able to say programatically that ipaddress_eth1 is the answer when
someone asks for ipaddress would be cool and then the default route looks like
a reasonable default - nothing more.
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.