Skip to content

Instantly share code, notes, and snippets.

@alex-harvey-z3q
Last active March 14, 2019 13:21
Show Gist options
  • Save alex-harvey-z3q/8d258549873c91795d5622b82986c772 to your computer and use it in GitHub Desktop.
Save alex-harvey-z3q/8d258549873c91795d5622b82986c772 to your computer and use it in GitHub Desktop.
Just fixing the syntax issues in:
class profile::sec::sec_model {
hiera_hash('users').each |String $user, Hash $user_hash| {
$user_hash.each |String $attr, String $value| {
user { "$user":
"${attr}" => "${value}"
}
}
}
}
I would end up with:
class profile::sec::sec_model {
lookup('users').each |String $user, Hash $user_hash| {
user { $user: * => $user_hash }
}
}
Noting:
- hiera_hash is deprecated, use lookup
- you had a redundant inner loop that didn't really make sense
- I think you imagined the code was going to be "eval"ed although Puppet has no eval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment