Last active
September 17, 2015 22:03
-
-
Save rnelson0/5cf77f00a9cb347326eb to your computer and use it in GitHub Desktop.
HI-118 workaround - deep merges are not supported properly in automatic parameter lookup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When using an externally provided module like mysql::server, we cannot modify the parameter lookups in the module. | |
# As a compromise, do lookups in our wrapper profile class and then pass on the values | |
class profile::mysql::server ( | |
$override_options = hiera_hash('mysql_server_override_options', {}), | |
$users = hiera_hash('mysql_server_users', {}), | |
$grants = hiera_hash('mysql_server_grants', {}), | |
$databases = hiera_hash('mysql_server_databases', {}), | |
) { | |
# ...do stuff... | |
# We have to instantiate the class rather than include it to pass values. | |
class {'::mysql::server': | |
override_options => $override_options, | |
users => $users, | |
grants => $grants, | |
databases => $databases, | |
} | |
include ::mysql::server::backup | |
include ::mysql::server::account_security | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When we make our own class that we want others to consume, or if we were able to contribute to an externally provided module, | |
# we can look up our own class's options with hiera_hash *in* the class parameters. | |
class your::own::class ( | |
$option = hiera_hash('your::own::class::option', undef), | |
) { | |
# ...do stuff.. | |
} | |
# In another class, "include ::your::own::class" works just fine even with deep merge. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment