The following custom fact:
# returns latest packerversion, e.g. 0.10.1
Facter.add("latest_packerversion") do
setcode do
url="https://www.packer.io/downloads.html"
file = open("#{url}")
contents = file.read()
match = contents.match(/Latest\sversion:\s(.*)</)
match[1]
end
end
worked using puppet 3.6.2
, but since the upgrade to 4.5.2
the following issue occurs:
Error: Facter: error while resolving custom fact "latest_packerversion":
No such file or directory @ rb_sysopen - https://www.packer.io/downloads.html
Analysis
rb_sysopen
could not be found anymore for some reason (No such file or directory @ rb_sysopen
) since the upgrade to Puppet 4.rb_sysopen
not exist in Ruby 2.1.5? No evidence was found.Question
Why could rb_sysopen
not be found anymore by the custom fact since the upgrade to Puppet4?
Concise
I will include require 'open-uri'
in both facts, but I do not understand why this is required since the upgrade to Puppet4
Verbose
Once require 'open-uri'
is included in one of the custom facts the issue is solved.
# returns latest gitversion, e.g. 2.8.2
Facter.add("latest_gitversion") do
setcode do
require 'open-uri'
url="https://git-scm.com/downloads"
file = open("#{url}")
contents = file.read()
match = contents.match(/RelNotes.*((\d\.){2}\d)/)
match[1]
end
end
As soon as the require 'open-uri'
has been commented out, the issue occurs again:
Error: Facter: error while resolving custom fact "latest_gitversion": No such file or directory @ rb_sysopen - https://git-scm.com/downloads
Error: Facter: error while resolving custom fact "latest_packerversion": No such file or directory @ rb_sysopen - https://www.packer.io/downloads.html
At the moment it is unclear what is causing the issue.