G'day. 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.
This is different from most of our platforms, where we just take the first address, and kind of falls down in the face of some regular conditions. This is consistent, though, with the ipaddress fact on Darwin – that also does the same route detection, and makes the same assumption; it even includes a "warn" when you don't have a default route. (Which, incidentally, means that puppet raises a warning from the facts every time it runs on a disconnected laptop.) So, my position is that the 'ipaddress' fact is daft: it doesn't actually have a standard meaning, so we are trying to second-guess what the end user imagined was the "primary" address for a machine. The only time that has any real standard meaning is when there is only a single address on the system – which will work right anyway – and that we are going to guess wrong some proportion of the time otherwise. Specific failure cases that spring to mind: * a system with two addresses on the interface with the default route * a system without a default route, like a router, or on a restricted network * a system with multiple default routes at different priorities * a system with multiple default routes at equal priority 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. One other complexity: the ipaddress6 fact tries a DNS lookup of the FQDN as the first step in determining the "primary" address. I actually *would* support this being our standard definition of the fact, but this is different from the ipaddress fact. That later just guesses from local data, so we have inconsistency between what should pretty much be identical facts. Any thoughts on which of those two models should win? Daniel -- ⎋ Puppet Labs Developer – http://puppetlabs.com ✉ Daniel Pittman <[email protected]> ✆ Contact me via gtalk, email, or phone: +1 (877) 575-9775 ♲ Made with 100 percent post-consumer electrons -- 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.
