Bug #5816

ipaddress fact uses the IP of the alphabetically earliest interface.

Added by Ricky Zhou over 1 year ago. Updated 6 months ago.

Status:Duplicate Start date:01/09/2011
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:library
Target version:-
Keywords: Affected Facter version:
Branch:
Votes: 0

Description

I have a machine with a dns0 interface, which ifconfig outputs before eth0 (it seems to output them in alphabetical order). I noticed that /sbin/ip from iproute2 (the replacement for the deprecated net-tools) seems to order interfaces by ifindex (?) which seems to be more reasonable.

Since net-tools/ifconfig are deprecated anyway, this seems like a reasonable change to make (although it might be worth double-checking that iproute2 is available in distros where facter is supported.

This patch changes the ipaddress fact to use /sbin/ip instead. If this is acceptable, it might be worth fixing other usages of net-tools as well.

http://ricky.fedorapeople.org/facter/0001-Use-iproute2-utility-for-ipaddress-fact.patch


Related issues

related to Facter - Bug #1346: Using 'ip addr' over ifconfig Code Insufficient 06/03/2008
related to Facter - Bug #4498: ipaddress* facts do not include secondary IPs Code Insufficient 08/08/2010

History

Updated by Paul Nasrat over 1 year ago

  • Status changed from Unreviewed to In Topic Branch Pending Review

Cool, quick scan of patch looks good.

It’d be nice if we could add a unit test to validate the ip addr show parsing. It may make sense to fallback to ifconfig, just in case some old systems exist without it.

Do you have a git branch with this on?

Updated by Ricky Zhou over 1 year ago

Sure, I have a ticket/1.5.x/5816 branch at git://fedorapeople.org/home/fedora/ricky/public_git/facter.git (gitweb http://fedorapeople.org/git/gitweb.cgi?p=ricky/public_git/facter.git).

It’d be nice to have tests for /sbin/ip output on many systems, but I’m not too familiar with working with the testing infrastructure for facter.

Updated by Jesse Wolfe about 1 year ago

  • Status changed from In Topic Branch Pending Review to Code Insufficient

I’m going to mark this “code insufficient” until someone volunteers to write a fact that falls back to ifconfig and we get a test for the /sbin/ip output

Updated by James Turnbull 9 months ago

  • Category set to library

Updated by Ken Barber 6 months ago

  • Status changed from Code Insufficient to Duplicate

This is a duplicate of #1346. Track your efforts to use ‘ip addr’ on that ticket from now on.

Also available in: Atom PDF