Skip to content

Commit

Permalink
B #-: Fix loading YAML with aliases (#3190)
Browse files Browse the repository at this point in the history
  • Loading branch information
xorel authored Aug 2, 2024
1 parent 015c735 commit 650fb59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/onecfg/lib/patch/apply.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ def apply(all = true)
#
# @param filename [String] path to patch in YAML format
def parse_yaml(filename)
@patches = YAML.load_file(filename)
if Psych::VERSION > '4.0'
@patches = YAML.load_file(filename, :aliases => true)
else
@patches = YAML.load_file(filename)
end

return if @patches.is_a?(Hash)

Expand Down
6 changes: 5 additions & 1 deletion src/onecfg/lib/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def load
reset

if ::File.exist?(@name)
@content = YAML.load_file(@name)
if Psych::VERSION > '4.0'
@content = YAML.load_file(@name, :alises => true)
else
@content = YAML.load_file(@name)
end
end
rescue StandardError => e
OneCfg::LOG.error("Can't load settings from '#{@name}' " \
Expand Down

0 comments on commit 650fb59

Please sign in to comment.