You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently explicit Hiera lookups in e.g. ssh::server overwrite globally configured Hiera merge strategies used when Puppet does automatic class parameter lookups, because the module tries to support and merge both Hiera data and class parameters.
Therefore you can't use e.g. knockout_prefix
Is this a common pattern btw.? - usally either automatic class parameter lookups via Hiera OR explicit class paramters are supported by modules.
Because of supporting both the lookup has to be explicit and it doesn't respect the globally configured merge behaviour:
# manifests/ssh/server.pp
class ssh::server(
...
# integrated with Hiera via automatic class parameter lookup
Hash $options = {},
...
) { ... # merge with additional explicit class parameters $hiera_options = lookup("${module_name}::server::options", Optional[Hash], 'deep', {}) $fin_options = deep_merge($hiera_options, $options) ...}
IMO common expected behaviour would be (explicit class parameter takes precedence)
AllowUsers myotheruser
The module should either use Hiera data via automatic class parameter lookup with explicit class parameter overrides while respecting global lookup_options like:
class ssh::server(
...
# integrated with Hiera via automatic class parameter lookup
Hash $options = {},
...
) {
# no merging of Hiera data and class parameter here
...
}
or provide a way to inject Hiera lookup options:
# manifests/ssh/server.pp
class ssh::server(
...
# integrated with Hiera via automatic class parameter lookup
Hash $options = {},
Hash $hiera_lookup_options = { 'strategy' => 'deep' },
...
) {
...
# merge with additional explicit class parameters
$hiera_options = lookup("${module_name}::server::options", {
'value_type' => Optional[Hash],
'merge' => $hiera_lookup_options,
})
$fin_options = deep_merge($hiera_options, $options)
...
}
Which would allow for correct merge behaviour with a knockout_prefix defined:
Of course having just the knockout_prefix as class parameter or hardcoding knockout_prefix with every lookup() would also be possible - I guess the solutions above would be the most flexible.
./discuss ;-)
The text was updated successfully, but these errors were encountered:
Currently explicit Hiera lookups in e.g.
ssh::server
overwrite globally configured Hiera merge strategies used when Puppet does automatic class parameter lookups, because the module tries to support and merge both Hiera data and class parameters.Therefore you can't use e.g.
knockout_prefix
Is this a common pattern btw.? - usally either automatic class parameter lookups via Hiera OR explicit class paramters are supported by modules.
Because of supporting both the lookup has to be explicit and it doesn't respect the globally configured merge behaviour:
Results (current behaviour) in:
IMO common expected behaviour would be (explicit class parameter takes precedence)
The module should either use Hiera data via automatic class parameter lookup with explicit class parameter overrides while respecting global
lookup_options
like:or provide a way to inject Hiera lookup options:
Which would allow for correct merge behaviour with a
knockout_prefix
defined:resulting in:
Of course having just the
knockout_prefix
as class parameter or hardcodingknockout_prefix
with everylookup()
would also be possible - I guess the solutions above would be the most flexible../discuss ;-)
The text was updated successfully, but these errors were encountered: