saltstack-formulas / samba-formula

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

In state "samba.user" "samba_smbpasswd_{{ login }}" gets executed each state.apply #68

Open xenadmin opened 4 years ago

xenadmin commented 4 years ago

https://github.com/saltstack-formulas/samba-formula/blob/389773442f849f4581e85d2b31cdf57157462b01/samba/users/init.sls#L14

This state uses a cmd.run which gets applied each time I do a state.apply. Is there a way to workaround this? This is a bit sad, because this will always result in a Changed=1

Summary for some host
-------------
Succeeded: 51 (changed=1)
Failed:     0
-------------
Total states run:     51
Total run time:    3.828 s

Could this be an alternative to cmd.run? https://docs.saltstack.com/en/latest/ref/states/all/salt.states.pdbedit.html#salt.states.pdbedit.managed

noelmcloughlin commented 4 years ago

Hi @xenadmin Thanks for raising the issue. I raised this PR for quick fix: https://github.com/saltstack-formulas/samba-formula/pull/69

There is an open issue for PBEdit here: https://github.com/saltstack-formulas/samba-formula/issues/35 but nobody implemented this.

xenadmin commented 4 years ago

Can you explain me what the PR does? If I understand you correctly, you fix running samba.users from beeing run, when not in use. But I explicitly rund the state as I need a user to access a share. Maybe we should take a look at #35 maybe I can solve this. I hate it when states get aplied again and again and this seems like the obvious solution.

noelmcloughlin commented 4 years ago

My PR only stopsusers state being run when init metastate is run. The users state handles smbpasswd user management and winbind-ad state handles active directory user management, neither should run by default. But yes, It does not fix this issue.

It would be great if you want to fix the issue using whatever solution suits (i.e. #35). Thanks!!