Open MathyV opened 3 years ago
I just tested the same version v0.23.4 of the formula and it works for me as expected.
It could be interesting to try to add some Kitchen/Inspec tests to validate the correct behaviour of the option but this is not done actually.
I'll see if I can create a minimal reproducible case
I can reproduce it with these minimal files:
salt/test.sls
include:
- sudoers
pillar/top.sls
base:
'*':
- common.sudoers
pillar/common/sudoers.sls
sudoers:
purge_includedir: true
groups:
sudo:
- 'ALL=(ALL) NOPASSWD: ALL'
Files I create in /etc/sudoers.d
aren't deleted when the state is applied. I tried both with a changed sudo config and without.
I can reproduce it with these minimal files:
salt/test.sls
include: - sudoers
Can you add sudoers.included
to this state list? I think the problem comes from it missing. This state manages the "included_dir" and its purge as you can see at https://github.com/saltstack-formulas/sudoers-formula/blob/master/sudoers/included.sls#L12.
And sudoers
state does not include sudoers.included
: not sure if there is a good reason to keep this behaviour or if we could make it a 'meta-state' like in others formulas.
That did the trick, perhaps it's already enough to document it somewhere, I didn't realize I needed to include the extra state but it does kinda make sense.
Your setup
Formula commit hash / release tag
v0.23.4
Versions reports (master & minion)
Pillar / config used
Bug details
Describe the bug
The purge_includedir option doesn't do anything when set to true
Steps to reproduce the bug
Expected behaviour
Extra files to disappear
Attempts to fix the bug
I made sure the correct value is exported in Pillar:
Additional context
I think this might be related to https://github.com/saltstack/salt/issues/26605 ?