Skip to content

Commit

Permalink
fix(postgres.manage): only reload modules if needed (fix: saltstack-f…
Browse files Browse the repository at this point in the history
…ormulas#214)

We don't want the `postgres-reload-modules` state reporting any changes
to the user unless there is a need to reload the modules. We should only
need to reload the modules if the state that manages installing the
client libraries makes any changes (ie. new packages installed).

In turn, the states created by the `format_state` macro only need to
ensure that any module reload occurs before those states are applied. In
which case using a `require` makes more sense that using `onchanges`
(which may not be guaranteed to trigger).
  • Loading branch information
jerrykan committed Sep 10, 2021
1 parent ce632b0 commit 76fd3c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion postgres/macros.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{{ state }}-{{ name }}:
{{ state }}.{{ ensure|default('present') }}:
{{- format_kwargs(kwarg) }}
- onchanges:
- require:
- test: postgres-reload-modules

{%- endmacro %}
Expand Down
2 changes: 2 additions & 0 deletions postgres/manage.sls
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ include:
postgres-reload-modules:
test.succeed_with_changes:
- reload_modules: True
- onchanges:
- pkg: postgresql-client-libs
# User states
Expand Down

0 comments on commit 76fd3c7

Please sign in to comment.