From 4b0f25262b02ec8aa6d10bb3d5f89521c83340b5 Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Wed, 29 Nov 2023 16:36:04 +0000 Subject: [PATCH] (GH-543) - Fix merging of nested default facts --- config_defaults.yml | 2 ++ moduleroot/spec/spec_helper.rb.erb | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config_defaults.yml b/config_defaults.yml index a6acd7b5..223b0b26 100644 --- a/config_defaults.yml +++ b/config_defaults.yml @@ -509,6 +509,8 @@ Gemfile: - gem: racc version: '~> 1.4.0' condition: "Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))" + - gem: deep_merge + version: '~> 1.0' - gem: 'voxpupuli-puppet-lint-plugins' version: '~> 5.0' - gem: 'facterdb' diff --git a/moduleroot/spec/spec_helper.rb.erb b/moduleroot/spec/spec_helper.rb.erb index 2d9a8673..f93ee276 100644 --- a/moduleroot/spec/spec_helper.rb.erb +++ b/moduleroot/spec/spec_helper.rb.erb @@ -27,7 +27,8 @@ default_fact_files.each do |f| next unless File.exist?(f) && File.readable?(f) && File.size?(f) begin - default_facts.merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true)) + require 'deep_merge' + default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true)) rescue StandardError => e RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" end