Issue #16665 has been updated by Sebastian Lehn.

File ipaddress.rb added
File ip.rb added

I tried myself to patch facter. I attached both files i needed to modify to get 
facter working correct.

I'll try to explain my changes for module `Facter::Util::IP` (see ip.rb):

1. two new methods, `getWindowsNetworkAdapters()`, 
`getWindowsNetworkAdapterConfiguration(interface, label)`
1. in method `get_output_for_interface_and_label(interface, label)` i placed 
the hook into `getWindowsNetworkAdapterConfiguration(interface, label)`
1. in method `get_all_interface_output` i have used 
`getWindowsNetworkAdapters()` to get IPEnabled Interfaces. At this point facter 
will loose to report the loopback interface of windows, because this one does 
not really exist. In my opinion, that is no problem because there is no real 
value in that facts. The loopback interface exist virtually on every windows 
and could, if needed, be reported as static fact.
1. in method `get_interfaces` the output of `get_all_interface_output` gets 
simply returned as uniq
1. i needed to change and extend REGEX_MAP with generic patterns for ipv4 and 
ipv6 addresses to be able to keep my new windows parts within 
`get_interface_value()` working
1. within `get_interface_value()` i needed to change handling of output_int, 
because my values returned by `get_output_for_interface_and_label(interface, 
label)` has no methods 'each_line'... maybe someone can improve here
1. Additionally for `getWindowsNetworkAdapterConfiguration(interface, label)` 
is a new MAP called WIN_WMI_MAP for mapping fact names to WMI attributes.


Now, my expanations for ipaddress.rb:

1. On Windows 2008 R2 Enterprise Server (German) setup as an domain controller 
with dns service installed and 127.0.0.1 as resolver plus another ip as backup 
resolver, the fact ipaddress returns only the hostname. 
2. In file ipaddress.rb is a second definition for fact ipaddress which tries 
to use Win32::Resolv to find the ipaddress. At this point, fact ipaddress seems 
to get overwritten. If i comment these second definition out, everythings works 
like a charm.


Okay, that's all about my changes. What's next?

----------------------------------------
Bug #16665: [windows] wrong ipaddress with locale != en
https://projects.puppetlabs.com/issues/16665#change-72365

Author: Sebastian Lehn
Status: Accepted
Priority: Normal
Assignee: 
Category: windows
Target version: 
Keywords: windows, ipaddress, netmask, ipaddress6
Branch: 
Affected Facter version: 1.6.11


Within module Facter::Util::IP

<pre>
   # A map of all the different regexes that work for
   # a given platform or set of platforms.
   REGEX_MAP = {
    :windows => {
      :ipaddress  => /\s+IP Address:\s+([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/,
      :ipaddress6 => /Address 
((?![fe80|::1])(?>[0-9,a-f,A-F]*\:{1,2})+[0-9,a-f,A-F]{0,4})/,
      :netmask  => /\s+Subnet Prefix:\s+\S+\s+\(mask 
([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\)/
    }
   }
</pre>

Regex contains english strings. That's why facter returns no ip address for 
interfaces and no netmask.



-- 
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