I got this working by modifying the regex which seems to be explicit for a
specific output, but in reality it could be simpler - unless I am missing
something. This change works for me now and I tested various interface
names (eth0, eth0.100, bond0, eth, WAN, LAN). Thoughts?
$ git diff ip.rb
diff --git a/lib/facter/util/ip.rb b/lib/facter/util/ip.rb
index 366303c..32d943e 100644
--- a/lib/facter/util/ip.rb
+++ b/lib/facter/util/ip.rb
@@ -56,7 +56,7 @@ module Facter::Util::IP
# at the end of interfaces. So, we have to trim those trailing
# characters. I tried making the regex better but supporting all
# platforms with a single regex is probably a bit too much.
- output.scan(/^[-\w]+[.:]?\d+[.:]?\d*[.:]?\w*/).collect { |i|
i.sub(/:$/, '') }.uniq
+ output.scan(/^[-\w]\S*/).collect { |i| i.sub(//, '') }.uniq
end
def self.get_all_interface_output
On Tue, Oct 5, 2010 at 9:37 AM, Christopher Johnston <[email protected]>wrote:
> Yes, but by X you mean they are represented with a digit? I have systems
> that do not have interfaces represented with the name and then a digit (WAN,
> LAN, BACKUP, etc). The regex looks to not pick those interfaces up.
>
>
> On Tue, Oct 5, 2010 at 9:31 AM, Joe McDonagh
> <[email protected]>wrote:
>
>> On 10/04/2010 05:35 PM, Christopher Johnston wrote:
>>
>>> Does facter support NICs that are not named ethX? I happen to use custom
>>> names on my systems. Just a quick look at the code I don't see why it
>>> wouldn't but the behavior I am seeing is very different. --
>>>
>>> You received this message because you are subscribed to the Google Groups
>>> "Puppet Users" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<puppet-users%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/puppet-users?hl=en.
>>>
>> On OpenBSD NIC devices are named based on the driver they use, and in some
>> cases the meta-type of the NIC (trunkX, carpX). Those all show up in facter
>> on those machines.
>>
>> --
>> Joe McDonagh
>> AIM: YoosingYoonickz
>> IRC: joe-mac on freenode
>> "When the going gets weird, the weird turn pro."
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<puppet-users%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" 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-users?hl=en.