Skip to content

Commit 5670b51

Browse files
committed
Merge remote-tracking branch 'upstream/6.x' into merge_6x_main_jan
* upstream/6.x: (packaging) Updating manpage file for 6.x (PUP-11405) Replace deprecated/changed Psych YAML methods, pin rdoc Conflicts: lib/puppet/util/yaml.rb The conflict was in the Puppet::Util::Yaml.load_file method because it was removed in Puppet 7. The patch to safe_load applied cleanly and is preserved in main.
2 parents 3607661 + c3ddb95 commit 5670b51

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)