-
Type:
Bug
-
Status: Resolved
-
Priority:
Normal
-
Resolution: Fixed
-
Affects Version/s: FACT 3.12.5, FACT 3.13.3, FACT 3.14.2
-
Fix Version/s: FACT 3.12.z, FACT 3.13.z
-
Component/s: Windows
-
Labels:None
-
Template:customfield_10700 316163
-
Team:Night's Watch
-
Story Points:5
-
Sprint:NW - 2019-08-07, NW - 2019-08-21
-
Method Found:Needs Assessment
-
Release Notes:Not Needed
-
Release Notes Summary:
-
QA Risk Assessment:Needs Assessment
Puppet Version: 6.0.9
Facter Version: 3.12.4 (commit ce9452fd2d15ed91eed9b8cc7823af783c9275a8)
OS Name/Version: Windows 2012
This custom fact succeeds on Linux but segfaults on Windows ... but only when calling facter -p not with puppet facts or puppet agent -t
require 'open-uri'
|
require 'json'
|
require 'timeout'
|
|
Facter.add('test') do
|
response = nil
|
begin
|
url = 'https://api.ipify.org?format=json'
|
Timeout::timeout(4) do
|
response = open(url).read
|
end
|
rescue
|
nil
|
end
|
if !response.to_s.empty?
|
result = JSON.parse(response)
|
setcode do
|
result['ip']
|
end
|
end
|
end
|
(Same segfault occurs if you use Net::HTTP.get(URI.parse('https://api.ipify.org?format=json')) instead of open(url).read)
Result attached.
- is caused by
-
LTH-163 Call ruby_sysinit to initialize Windows sockets
-
- Resolved
-