Skip to content

Commit 2fff563

Browse files
authored
Merge pull request #9008 from smortex/fqdn_rand_legacy_facts-7
(PUP-11752) Fix usage of legacy fact in fqdn_rand
2 parents a11fbba + c0d2560 commit 2fff563

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/puppet/parser/functions/fqdn_rand.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
initial_seed = args.shift
2424
downcase = !!args.shift
2525

26-
fqdn = self['::fqdn']
26+
fqdn = self['facts'].dig('networking', 'fqdn')
2727
fqdn = fqdn.downcase if downcase
2828

2929
# Puppet 5.4's fqdn_rand function produces a different value than earlier versions

spec/unit/parser/functions/fqdn_rand_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def fqdn_rand(max, args = {})
8080
extra = args[:extra_identifier] || []
8181

8282
scope = create_test_scope_for_node('localhost')
83-
scope.compiler.topscope['fqdn'] = host.freeze
83+
scope.set_facts({ 'networking' => { 'fqdn' => host }})
8484

8585
scope.function_fqdn_rand([max] + extra)
8686
end

0 commit comments

Comments
 (0)