Issue #17487 has been updated by Alex Harvey.

Based on the discussion linked above I submitted the following sed command -

<pre>
diff --git a/lib/facter/util/ip.rb b/lib/facter/util/ip.rb
index 3a52bbb..a048b00 100644
--- a/lib/facter/util/ip.rb
+++ b/lib/facter/util/ip.rb
@@ -78,7 +78,9 @@ module Facter::Util::IP
     when 'SunOS'
       output = %x{/usr/sbin/ifconfig -a}
     when 'HP-UX'
-      output = %x{/bin/netstat -in | sed -e 1d}
+      # see discussion at https://github.com/puppetlabs/facter/pull/232 and
+      # https://projects.puppetlabs.com/issues/11612.
+      output = %x{/bin/netstat -in | sed -e '1d; /none/d; s/*//g'}
     when 'windows'
       output = %x|#{ENV['SYSTEMROOT']}/system32/netsh.exe interface ip show 
interface|
       output += %x|#{ENV['SYSTEMROOT']}/system32/netsh.exe interface ipv6 show 
interface|
</pre>

Once the code is refactored I would use Ruby instead of sed to modify the 
netstat -in.  In case others want fixtures here are some netstat -in examples -

<pre>
Name           Mtu Network            Address                 Ipkts      Opkts
lan1          1500 10.1.1.0           10.1.1.6            435347580    1287271
lan0          1500 192.168.3.0        192.168.3.10         28101904 3569941319
lo0           4136 127.0.0.0          127.0.0.1             5071536    5071539
</pre>

<pre>
Name      Mtu  Network         Address         Ipkts   Ierrs Opkts   Oerrs Coll
lan1      1500 10.1.54.0       10.1.54.36      117489535 0     1681709 0     79
lan0      1500 192.168.30.0    192.168.30.152  964843646 0     1668475345 0     0
lo0       4136 127.0.0.0       127.0.0.1       4658855 0     4658855 0     0
</pre>

<pre>
Name      Mtu  Network         Address         Ipkts   Ierrs Opkts   Oerrs Coll
lan1*     1500 10.10.0.0       10.10.0.5       786     0     240     0     0
lan0      1500 192.168.3.0     192.168.3.9     1823744990 0     23598735 0     0
lo0       4136 127.0.0.0       127.0.0.1       7048047 0     7048047 0     0
</pre>

<pre>
Name      Mtu  Network         Address         Ipkts   Ierrs Opkts   Oerrs Coll
lan4:1    1500 192.168.1.0     192.168.1.197   121     0     6       0     0
lan3*     1500 none            none            0       0     0       0     0
lan1      1500 192.168.30.0    192.168.30.32   211188606 0     132070934 0     0
lo0       4136 127.0.0.0       127.0.0.1       513508160 0     513509185 0     0
lan4      1500 192.168.32.0    192.168.32.75   2640827721 0     2257447701 0    
 0
</pre>

----------------------------------------
Bug #17487: 'no such interface' sometimes printed on HP-UX platforms
https://projects.puppetlabs.com/issues/17487#change-76837

Author: Alex Harvey
Status: Unreviewed
Priority: Normal
Assignee: Alex Harvey
Category: hpux
Target version: 1.6.x
Keywords: 
Branch: 
Affected Facter version: 1.6.14


On HP-UX platforms facter sometimes prints errors -

<pre>
$ facter
ifconfig: no such interface
ifconfig: no such interface
ifconfig: no such interface
ifconfig: no such interface
ifconfig: no such interface
ifconfig: no such interface
ifconfig: no such interface
ifconfig: no such interface
ifconfig: no such interface
ifconfig: no such interface
ifconfig: no such interface
ifconfig: no such interface
architecture => ia64
...
</pre>

This was identified by Hongbo Hu who submitted a patch in #11612.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to