Skip to content

Commit 98cfe56

Browse files
Merge pull request #8854 from joshcooper/merge_6x_main_jan
(maint) Merge 6.x to main
2 parents 3607661 + 5670b51 commit 98cfe56

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/puppet/util/yaml.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ class YamlLoadError < Puppet::Error; end
2424
# @raise [YamlLoadException] If deserialization fails.
2525
# @return The parsed YAML, which can be Hash, Array or scalar types.
2626
def self.safe_load(yaml, allowed_classes = [], filename = nil)
27-
data = YAML.safe_load(yaml, allowed_classes, [], true, filename)
27+
if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0')
28+
data = YAML.safe_load(yaml, permitted_classes: allowed_classes, aliases: true, filename: filename)
29+
else
30+
data = YAML.safe_load(yaml, allowed_classes, [], true, filename)
31+
end
2832
data = false if data.nil?
2933
data
3034
rescue ::Psych::DisallowedClass => detail

0 commit comments

Comments
 (0)