Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
FACT 3.4.1
-
Windows Server 2012R2 with facter 3.4.1
-
-
Agent
-
2
-
AP 2017-01-11
-
Bug Fix
-
An issue has been corrected that could cause custom Ruby facts running on Windows to fail to run if they made use of the Ruby network stack (such as Net::HTTP).
-
No Action
-
covered by unit tests
Description
Customer reports: I have implemented a custom fact using net/http to query a service on the local host, however when the code is run from facter on Windows Server 2012R2/2016 the following error is received:
ERROR puppetlabs.facter - error while resolving custom fact "testy": getaddrinfo: Either the application has not called WSAStartup, or WSAStartup failed.
Simplified example code:
require 'net/http' |
Facter.add('testy') do |
setcode do |
uri = URI("http://www.apple.com") |
if ( Net::HTTP.get_response(uri) ) |
'Apple II Forever' |
else |
'Altair' |
end
|
end
|
end
|
The same, minus 'Facter.add('testy') do setcode do' succeeds using puppet ruby outside of facter.