Skip to content

Commit

Permalink
Knockout prefix reproduction
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcooper committed May 16, 2024
1 parent 779595a commit 96bfd3e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion examples/hiera/data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ ntp::config::ntpservers:

lookup_options:
classes:
merge: unique
merge:
strategy: deep
knockout_prefix: --
1 change: 1 addition & 0 deletions examples/hiera/data/dc1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ ntp::config::ntpservers:
- 'ntp1.dc1.example.com'
- 'ntp2.dc1.example.com'
classes:
- --ntp::config
- users::dc1
2 changes: 2 additions & 0 deletions examples/hiera/data/production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
classes:
6 changes: 4 additions & 2 deletions examples/hiera/hiera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ defaults:

hierarchy:
- name: 'Per Location'
path: "%{facts.location}.yaml"
path: 'dc1.yaml'
#%{facts.location}.yaml"

- name: 'Per Environment'
path: "%{facts.environment}.yaml"
path: 'production.yaml'
# path: "%{facts.environment}.yaml"

- name: 'Common Data'
path: 'common.yaml'
4 changes: 3 additions & 1 deletion lib/puppet/pops/merge_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,9 @@ def checked_merge(e1, e2)
dm_options = { :preserve_unmergeables => false }
options.each_pair { |k, v| dm_options[k.to_sym] = v unless k == 'strategy' }
# e2 (the destination) is deep cloned to avoid that the passed in object mutates
DeepMerge.deep_merge!(e1, deep_clone(e2), dm_options)
rval = DeepMerge.deep_merge!(e1, deep_clone(e2), dm_options)
puts "Merging #{e1.inspect} with #{e2.inspect} result #{rval.inspect}"
rval
end

def deep_clone(value)
Expand Down

0 comments on commit 96bfd3e

Please sign in to comment.