-
-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do a deep
merge on fpm
lookup
#550
Conversation
Hi @sigv, thanks for the fix. Can you add a test for it? |
The
Documentation suggests setting |
@bastelfreak please don't merge, because we should go in the oposite direction and get rid of ALL hardcoded lookups. the hardcoded lookups break puppets ability to define the merge behavior in hiera files (Automatic class parameter lookup). @sigv you can define the merge behavior you want in your hiera. in your case simply add this to your hiera file (you can add it to your global hiera file and you can also change the lookup behavior from your global hiera file on any other hiera level.
also see my issue #434 |
@c33s I do agree that variables should be pulled in auto-magically without using the |
I could switch it out to be a |
My personal opinion is to get rid of all those lookup calls and use automatic class parameter lookup. That's also the prefered way in the puppet style guide. |
Is the default merge behavior change a no-go for |
The current state of PR should have the same behavior ( |
@sigv i don't understand why defining merging behavior in your hiera data doesn't it fit your needs? You can try this syntax also:
|
Of course I could add this and I get the default auto lookup behavior as well:
At the current state, if someone follows documentation on how to configure via Hiera, they add a If the |
this is a good catch, thank you very much for that.
my opinion is different here, if we touch something, it should be better afterwards. for me the argument does not count to say "it makes no sense to clean a room because the whole flat is dirty". as far as i can see its just: Line 102 in d711fc7
->
this solution does not need much effort. the cleaner way would be to refactor the used variable names. i already fixed that in my fork quite a while ago for @sigv & @Dan33l i am not sure (can't remember) if it simply works by adding the for me using the lookup function inline breaks puppet. the remove of this function would be the right way for me. |
Puppet documentation states `unique` ("array merge") behavior will return a merged array and will fail for hashes. We can instead rework this lookup function to automatically lookup the variables as per current best practises. This change is in line with b188888. Closes voxpupuli#536.
@c33s Fair. Dropped |
My understanding is also that I apologize, i though we were talking about automatic parameter lookup. I am not a user of this module. So, now i read the code, i am seeing that it is hard coded lookup. I agree that a clean way is to find a way to not hard code the lookup, if possible. |
That is indeed the current state of the PR - to switch the FPM pools variables over to automatic lookup. |
Not that many people know this is an option and can get confused as to why their resources are missing bits and pieces that are in fact defined in their Hiera sources. This should clear all of that up.
More details and explanatory examples in use for `lookup_options`.
Based on further request in PR.
Is this still waiting for further approval after the LGTM? I don't have push/merge rights. |
we are waiting for @bastelfreak s approval. he's quite busy right now. i have the permission to merge, but it is my first merge here, so i wait for his decision. after he is ok with my reviews i will merge such requests faster in future. |
Got it - no worries. Just wanted to hear what's going on. |
Hi people, sorry for the delay here. |
What's the actual fix here? It's not very clear at all, and the suggestion in the documentation still results in this error. Edit: I see a new release wasn't made yet, which is why the behaviour is still observed. |
@phyber what exactly are you trying to do? can you show me some code snippets? you only have to add the following code to your hiera data for example lookup_options:
php::fpm::pools:
merge: hash my lookup_options:
profile::nginx::servers: { merge: {strategy: deep, merge_hash_arrays: true, knockout_prefix: "--", sort_merged_arrays: true}}
profile::nginx::upstreams: { merge: {strategy: deep, merge_hash_arrays: true, knockout_prefix: "--", sort_merged_arrays: true}}
profile::nginx::mailhost: { merge: {strategy: deep, merge_hash_arrays: true, knockout_prefix: "--", sort_merged_arrays: true}}
sysctl::values: { merge: first } |
The version of Puppet here is 5.5.10 (Debian stable), the PHP module is 7.0.0. I have php::fpm::pools:
www:
user: 'www-data'
group: 'www-data'
listen: '/run/php/php7.3-fpm.sock'
etc: ... The lookup options are specified in my top level lookup_options:
php::fpm::pools:
merge:
strategy: 'hash' We can see this working in the
Running apply or noop results in the following:
Everything looks like it should be working. |
After playing around with this, it feels like what's happening here is that it doesn't matter that you passed This appears to be because the merge strategy in the Fortunately, it looks like 7.0.1 is happening soon (#563), which should fix the issue thanks to this PR. |
Pull Request (PR) description
When allowing configuring
php::fpm::pools
as hashes in Hiera, theunique
("array merge") behavior is currently used. Documentation states this will return a merged array even though we are interested in a hash. Instead of doing this manual lookup, we can switch to auto lookups.This Pull Request (PR) fixes the following issues
Fixes #536