Skip to content

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
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions postgres/codenamemap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
{{ debian_codename('vivid', '9.4') }}
{{ debian_codename('wily', '9.4') }}
{{ debian_codename('xenial', '9.5') }}
{{ debian_codename('bionic', '10') }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds codename for Ubuntu 18.04 "bionic". This was all I needed to change to get Postgres 10 working for Ubuntu 18.04.


## Fedora
# `oscodename` grain has long distro name
Expand Down
2 changes: 2 additions & 0 deletions postgres/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ postgres:

bake_image: False

manage_force_reload_modules: True
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New config setting defaults to True to preserve existing behavior.


fromrepo:

users: {}
Expand Down
8 changes: 7 additions & 1 deletion postgres/manage.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{%- from tpldir + "/map.jinja" import postgres with context -%}
{%- from tpldir + "/macros.jinja" import format_state with context -%}

{%- if salt['postgres.user_create']|default(none) is not callable %}
{%- set needs_client_binaries = salt['postgres.user_create']|default(none) is not callable -%}

{%- if needs_client_binaries %}

# Salt states for managing PostgreSQL is not available,
# need to provision client binaries first
Expand All @@ -15,12 +17,16 @@ include:

{%- endif %}

{%- if needs_client_binaries or postgres.manage_force_reload_modules %}
Copy link
Contributor Author

@RobRuana RobRuana Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybemange_force_reload_modules should default to False to fix #214 @vunty what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm totally fine with setting mange_force_reload_modules to False by default.


# Ensure that Salt is able to use postgres modules

postgres-reload-modules:
test.succeed_with_changes:
- reload_modules: True

{%- endif %}

# User states

{%- for name, user in postgres.users|dictsort() %}
Expand Down