-
Notifications
You must be signed in to change notification settings - Fork 283
Makes postgres-reload-modules conditional #216
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
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
984cf4e
Adds Ubuntu "bionic" codename & makes reload-modules conditional
RobRuana 4dd99d5
Allows postgres-reload-modules to always run, only the changes are co…
RobRuana ed74e86
Adds Ubuntu "bionic" codename & makes reload-modules conditional
RobRuana a9498ad
Allows postgres-reload-modules to always run, only the changes are co…
RobRuana 69fc654
Merge saltstack-formulas master
RobRuana 5115e45
Merge branch 'master' into master
RobRuana f6f4998
Removes extraneous whitespace
RobRuana d2408a4
Make sure postgresql-conf runs before postgresql-running
RobRuana 32f45e9
Force postgresql service restart instead of reload
RobRuana 41033a2
Merge pull request #1 from saltstack-formulas/master
RobRuana 42580d7
Reverts force service restart, as this issue was fixed upstream
RobRuana 5c77a33
Uses watch requisite for postgres-reload-modules instead of onchanges
RobRuana ef87358
Reloading the postgres service is not enough to pick up ACL changes i…
RobRuana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,8 @@ postgres: | |
|
||
bake_image: False | ||
|
||
manage_force_reload_modules: False | ||
|
||
fromrepo: '' | ||
|
||
users: {} | ||
|
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,13 +143,6 @@ postgresql-conf: | |
|
||
{%- endif %} | ||
|
||
# Restart the service where reloading is not sufficient | ||
# Currently when the cluster is created or changes made to `postgresql.conf` | ||
postgresql-service-restart: | ||
module.wait: | ||
- name: service.restart | ||
- m_name: {{ postgres.service }} | ||
|
||
{%- set pg_hba_path = salt['file.join'](postgres.conf_dir, 'pg_hba.conf') %} | ||
|
||
postgresql-pg_hba: | ||
|
@@ -176,6 +169,15 @@ postgresql-pg_hba: | |
{%- endif %} | ||
- require: | ||
- file: postgresql-config-dir | ||
- watch_in: | ||
- module: postgresql-service-restart | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
|
||
# Restart the service where reloading is not sufficient | ||
# Currently when the cluster is created or changes made to `postgresql.conf` | ||
postgresql-service-restart: | ||
module.wait: | ||
- name: service.restart | ||
- m_name: {{ postgres.service }} | ||
|
||
{%- set pg_ident_path = salt['file.join'](postgres.conf_dir, 'pg_ident.conf') %} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 whenpostgres.manage_force_reload_modules
setTrue
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 ofrequire: postgres-reload-modules
. But then I realized that many instances offormat_state()
are already using therequire
conditional, so there would be conflictingrequire
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 everyformat_state()
to run when there are changes inpostgres-reload-modules
.If that's correct, then we should be able to achieve the same result by using
watch
instead ofonchanges
informat_state()
. I've made that change. Please let me know if you think that works.