From 823dde7dcfe1c5e2158d8ada798e33395b4718ea Mon Sep 17 00:00:00 2001 From: John Kristensen Date: Thu, 9 Sep 2021 00:34:57 +1000 Subject: [PATCH] fix(postgres.manage): only reload modules if needed (fix: #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). --- postgres/macros.jinja | 2 +- postgres/manage.sls | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/postgres/macros.jinja b/postgres/macros.jinja index abd2c9c1..083ac5b9 100644 --- a/postgres/macros.jinja +++ b/postgres/macros.jinja @@ -26,7 +26,7 @@ {{ state }}-{{ name }}: {{ state }}.{{ ensure|default('present') }}: {{- format_kwargs(kwarg) }} - - onchanges: + - require: - test: postgres-reload-modules {%- endmacro %} diff --git a/postgres/manage.sls b/postgres/manage.sls index 38e815da..f2aaf7c8 100644 --- a/postgres/manage.sls +++ b/postgres/manage.sls @@ -20,6 +20,8 @@ include: postgres-reload-modules: test.succeed_with_changes: - reload_modules: True + - onchanges: + - pkg: postgresql-client-libs # User states