Skip to content

Commit 1adccf5

Browse files
committed
Avoid hardcoding ipaddress6 default
In 4ef2f36 this was added as a workaround, but in 48c5605 a custom Facter implementation was added. This avoids any calls to the real Facter and doesn't suffer from the issue where it was attempting to load Windows gems on Linux.
1 parent b478497 commit 1adccf5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/rspec-puppet/support.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,18 @@ def facts_hash(node)
241241
'hostname' => node.split('.').first,
242242
'fqdn' => node,
243243
'domain' => node.split('.', 2).last,
244-
'clientcert' => node,
245-
'ipaddress6' => 'FE80:0000:0000:0000:AAAA:AAAA:AAAA'
244+
'clientcert' => node
246245
}
247246

247+
# Puppet 6.9.0 started setting a `serverip6` server fact which is set
248+
# using the value of the `ipaddress6` fact. If the fact set(s) provided
249+
# by FacterDB don't have an `ipaddress6` fact set, then the normal Facter
250+
# fact will be resolved, which can result in Ruby trying to load Windows
251+
# only gems on Linux. This is only a problem if facter is used.
252+
if RSpec.configuration.facter_implementation.to_sym == :facter
253+
node_facts['ipaddress6'] = 'FE80:0000:0000:0000:AAAA:AAAA:AAAA'
254+
end
255+
248256
networking_facts = {
249257
'hostname' => node_facts['hostname'],
250258
'fqdn' => node_facts['fqdn'],

0 commit comments

Comments
 (0)