Bug #1321

Facter (ipmess.rb) truncating Xen virtual interfaces

Added by James Turnbull almost 3 years ago. Updated almost 3 years ago.

Status:Closed Start:
Priority:Normal Due date:
Assignee:James Turnbull % Done:

0%

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

Description

Facter 1.3.8 has a module called ipmess.rb that does not handle interface names with decimals, hence Xen virtual interfaces names get truncated. Therefore, dubious errors are displayed when ipmess.rb goes to do an ifconfig on interface vif3 instead of vif3.0.

Example: Output of ifconfig -a to show Xen virtual interfaces

ifconfig -a (output has been shorten for brevity)

vif0.1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF

      BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

vif0.2 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF

      BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

vif0.3 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF

      BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Output to show facter version and errors

facter -v

vif0: error fetching interface information: Device not found vif0: error fetching interface information: Device not found vif0: error fetching interface information: Device not found vif0: error fetching interface information: Device not found vif1: error fetching interface information: Device not found vif2: error fetching interface information: Device not found vif3: error fetching interface information: Device not found vif7: error fetching interface information: Device not found 1.3.8

Proposed patch:

*** ipmess.rb 2007-09-24 03:00:05.000000000 -0400 —– /tmp/ipmess.rb 2007-11-04 17:00:44.000000000 -0500


* 21,27 **

     output = %x{/sbin/ifconfig -a}
     int = nil

! output.scan(/(\w+)(\d+)/) { |str|

       output_int = %x{/sbin/ifconfig #{str}}
       int = "#{str}"
       tmp1 = nil

—– 21,27 ——

     output = %x{/sbin/ifconfig -a}
     int = nil

! output.scan(/(\w+)(\d+)(.?)(\d+)*/) { |str|

       output_int = %x{/sbin/ifconfig #{str}}
       int = "#{str}"
       tmp1 = nil

ipmess.patch (572 Bytes) James Turnbull, 11/05/2007 12:44 am

History

Updated by James Turnbull almost 3 years ago

I think:

output.scan(/^(\w+)(\.|:?)(\d+)/) { |str|

might work better?

Then we catch:

eth1.1 eth1:1 eth0 eth01 etc etc

Comments?

Updated by Jason Hartley almost 3 years ago

Replying to [comment:2 jamtur01]:

I think:

output.scan(/(\w+)(.|:?)(\d+)/) { |str|

might work better?

Then we catch:

eth1.1 eth1:1 eth0 eth01 etc etc

Comments?

Darn it! I had thought about including a “:” to catch aliases and forgot. Good catch. I think that is much better.

Updated by James Turnbull almost 3 years ago

  • Status changed from 1 to Closed
  • 7 set to fixed

Now fixed in Git.

Also available in: Atom PDF