saltstack-formulas / postgres-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
77 stars 283 forks source link

fix(postgres.manage): only reload modules if needed (fix: #214) #321

Open jerrykan opened 3 years ago

jerrykan commented 3 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

214

Describe the changes you're proposing

I've read through the comments of other pull requests related to this issue to try and understand what the postgres-reload-modules state is trying to solve. Apologies if this attempted fix is a bit naive.

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). This is why we have added onchanges to the postgres-reload-modules state.

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).

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Documentation checklist

Testing checklist

Additional context