-
Notifications
You must be signed in to change notification settings - Fork 284
Resolve #148: workaround prereq
causing infinite recursion
#149
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
Conversation
I'd only make a little change here: I'd move backup logic one level up (at the same level of the ACLs conditional), so they're 'independent' and make things clearer. In this PR, backup logic is inside the acls condition. And while I understand that currently, if no ACLs are declared, probably no change will happen to the file and no backup is needed, I think there's no need to force the dependency between both declarations. What do you think? |
Thanks for quick response @javierbertoli ! Yes, indeed, there will be no change to the And that's why I've put "backup" condition statement inside "ACL" condition.
So, making the decision about "to backup" or "not to backup" depends on the ACL list configuration. I hope I explained all this stuff clearly. |
@javierbertoli Do you have any concerns about what I wrote above? |
Most of the time, as soon as you install the package you'll have a But it's your call, I can live with both behaviours 😄 . Do you want me to merge it as is? |
@javierbertoli I completely agree with you. My aim is to resolve the issue, but bringing random stuff to the repo is not we wanna do here 😄 So, I really would like to have my changes not only to be accepted, but also understood. Let me clarify the backup strategy case by case. It really doesn't change much from the previous revision.
Basically, the backup will always be taken when the ACL change is detected. There is no changes from previous behavior in this scenario. About this statement: Did I explain it better this time? |
Hi @vutny, sorry for the delay, I got sidetracked by work 😄. I understand your description on how this work just, as I said, I like the idea better of backups being done when file change, independently of ACLs. I consider conf file backup ( As the PR is right now, you're counting with the fact that ACLs are always there (because As I said, it's a minor thing atm, not that critical. I'll merge as is, in order to fix #148. We can get to this back later I guess. Thanks for all your work! 👍 |
Awesome, @javierbertoli I totally understand your concern and I personally don't like to have such complex "workarounds" at all. I strongly believe this is caused by Salt bug, but still I had no chance to dive deeper into it. I think later we will be able to get rid of this questionable stuff. |
This PR is a fix for the issue #148, which caused by PR #138. It appears that recent (?) versions of Salt are unable to process the
prereq
requisite correctly.So, instead of having separate state to make a backup of the
pg_hba.conf
file, which is going to be modified during thepostgres.server
SLS run, the file copy will be created right before the modification by facilitatingfile.managed
state-specific requisite parameter:check_cmd
. This is the only option I found so far to be working reliably.There is only one special case where its behavior is not optimal, i.e. when
pg_hba.conf
does not exist at all. Salt cannot copy the file which is absent and return and error code which causes the state failure. That's why I usedonlyif
requisite to create the file ahead if it is missing, which is rare, because the formula is designed to modify distribution-provided configuration.Anyhow, the side effects of managing previously absent
pg_hba.conf
file are the empty backup file (nothing to backup really) and the salt state call does report full diff (which is nice I think).