Skip to content

Instantly share code, notes, and snippets.

@gabe-sky
Last active June 8, 2018 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabe-sky/61b4be19063c9df9c939ec295c6669eb to your computer and use it in GitHub Desktop.
Save gabe-sky/61b4be19063c9df9c939ec295c6669eb to your computer and use it in GitHub Desktop.
Compare this lookup:
------------->8------- cut here ------->8-------
# nodes/rizzo.puppetlabs.vm
---
hashme::myhash:
flarghies:
smarghies:
- 'a'
- 'b'
# common.yaml
---
hashme::myhash:
flarghies:
smarghies:
- 'b'
- 'c'
klarghies:
- 'f'
# hashme/manifests/init.pp
class hashme {
$myhash = lookup({ "name" => "hashme::myhash",
"merge" => "deep",
})
notify { "${myhash}": }
}
------------->8------- cut here ------->8-------
To this deep_merge:
------------->8------- cut here ------->8-------
$hishash = { 'flarghies' => { smarghies => ['a','b'] } }
$herhash = { 'flarghies' => {
smarghies => ['b','c'],
'klarghies' => ['f']
}
}
$ourhash = deep_merge($hishash,$herhash)
notify { "${ourhash}": }
------------->8------- cut here ------->8-------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment