Hi folks,
Is there a way to test the result of a hiera_hash() lookup in a manifest? I
am trying to use hiera to do most of my configuration, like this for
example:
mysql::grants:
'user1@localhost':
privileges:
- select_priv
'user2@localhost':
privileges:
- select_priv
- insert_priv
- lock_tables_priv
I have a wrapper class that then does this:
class custom::mysql::grants {
$grantoptions = hiera_hash('mysql::grants')
create_resources('database_grant', $grantoptions)
}
That works fine as long as I include the custom::mysql::grants class. But
right now I can only include that class on nodes where I define explicit
grants. If I don't have the mysql::grants hash defined for that node in
hiera, puppet complains:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
Could not find data item mysql::grants in any Hiera data file and no
default supplied at /path/to/custom/manifests/mysql.pp:34
I tried testing the $grantoptions variable after calling hiera_hash() but
that's too late - it's the hiera_hash function itself that produces that
error. I would love to be able to just include this wrapper class globally,
and then have it only run create_resources if it actually finds a usable
hash for that node, so I don't have as many includes on each individual
node.
Any thoughts?
Thanks!
Chris
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.