Makes postgres-reload-modules conditional#216
Makes postgres-reload-modules conditional#216RobRuana wants to merge 13 commits intosaltstack-formulas:masterfrom
Conversation
| {{ debian_codename('vivid', '9.4') }} | ||
| {{ debian_codename('wily', '9.4') }} | ||
| {{ debian_codename('xenial', '9.5') }} | ||
| {{ debian_codename('bionic', '10') }} |
There was a problem hiding this comment.
Adds codename for Ubuntu 18.04 "bionic". This was all I needed to change to get Postgres 10 working for Ubuntu 18.04.
postgres/defaults.yaml
Outdated
|
|
||
| bake_image: False | ||
|
|
||
| manage_force_reload_modules: True |
There was a problem hiding this comment.
New config setting defaults to True to preserve existing behavior.
postgres/manage.sls
Outdated
|
|
||
| {%- endif %} | ||
|
|
||
| {%- if needs_client_binaries or postgres.manage_force_reload_modules %} |
There was a problem hiding this comment.
I was getting tired of postgres-reload-modules running even when nothing had changed. I hid the state behind a conditional that checks if any new client binaries were installed, or if manage_force_reload_modules was set to True.
NOTE: manage_force_reload_modules defaults to True to preserve the existing behavior.
There was a problem hiding this comment.
Maybemange_force_reload_modules should default to False to fix #214 @vunty what do you think?
There was a problem hiding this comment.
I'm totally fine with setting mange_force_reload_modules to False by default.
noelmcloughlin
left a comment
There was a problem hiding this comment.
LGTM, I have just one outstanding query.
vutny
left a comment
There was a problem hiding this comment.
@RobRuana Thanks for your PR!
Since we already have a PR submitted to add support for Ubuntu 18, I propose to separate concerns and focus on fixing issue #214 here. I found it really annoys people 😃
Also I think you need to add conditional to macros.jinja file, as each state produced by format_state macro has explicit requirement on the postgres-reload-modules.
|
Okay, I merged the codename changes from Furthermore, I repositioned the conditional so |
| test.succeed_with_changes: | ||
| {%- else %} | ||
| test.succeed_without_changes: | ||
| {%- endif %} |
There was a problem hiding this comment.
@RobRuana This seems like an obvious fix, but that wouldn't work.
Each state generated below explicitly subscribed on changes in postgres-reload-modules. So if you later change PG entities in the Pillar, it will not have any effect.
The only way I see to overcome this: you need to put conditional in format_state macro to depend on modules reload only when postgres.manage_force_reload_modules set True.
There was a problem hiding this comment.
@vutny, yes, you are correct that this breaks any state using the format_state() macro.
At first I couldn't understand why onchanges: postgres-reload-modules was being used instead of require: postgres-reload-modules. But then I realized that many instances of format_state() are already using the require conditional, so there would be conflicting require keys when the state is rendered.
Correct me if I'm wrong, but I believe onchanges is being used to force correct ordering of the states, not because we want every format_state() to run when there are changes in postgres-reload-modules.
If that's correct, then we should be able to achieve the same result by using watch instead of onchanges in format_state(). I've made that change. Please let me know if you think that works.
| - enable: True | ||
| {% if grains.os not in ('MacOS',) %} | ||
| - reload: True | ||
| {% endif %} |
There was a problem hiding this comment.
@RobRuana This has already been resolved by 79ab1a2 during #218:
postgres-formula/postgres/server/init.sls
Lines 141 to 151 in 332fe7b
There was a problem hiding this comment.
Thanks for the notice! I'm scrambling to get everything working at the moment, and this was my quick and dirty fix. I've synced with upstream.
|
@vutny could you take another look and ping me if it's ok? |
|
@aboe76 @RobRuana My in-line comment above still applies. All latter states in |
| - require: | ||
| - file: postgresql-config-dir | ||
| - watch_in: | ||
| - module: postgresql-service-restart |
There was a problem hiding this comment.
I've found that simply reloading the postgres service is not enough to pick up ACL changes in pg_hba.conf. A full restart is required.
This is on ubuntu 18.04 with postgres 10.
|
I'm going to close this pull request for now. I may revisit this issue, but for now I am okay with the |
…formulas#214 Based on the great work of @RobRuana in saltstack-formulas#216.
…formulas#214 Based on the great work of @RobRuana in saltstack-formulas#216.
This pull request makes the
postgres-reload-modulesconditional so it doesn't report changes during every run.