saltstack-formulas / users-formula

Configure users via pillar
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
99 stars 360 forks source link

fix(pillars): ensure `addusers` & `delusers` are lists #215

Closed myii closed 4 years ago

myii commented 4 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

Describe the changes you're proposing

Found this problem some time back while testing saltcheck tests with this formula.

https://github.com/saltstack-formulas/users-formula/blob/5e6846b1735406395bec572f0b58c1ed39189f11/users/init.sls#L14-L21

Pillar / config required to test the proposed changes

Found with the following saltcheck tests:

{%-     for section in ['members'] %}
{%-       for member in (setting.get('addusers', []) + setting.get('members', [])) %}
validate_users_group_present_{{ group }}_{{ section }}_{{ member }}_present:
  module_and_function: group.info
  args:
    - '{{ group }}'
  assertion: assertIn
  assertion_section: '{{ section }}'
  expected-return: '{{ member }}'
{%-       endfor %}
{%-       for member in setting.get('delusers', []) %}
validate_users_group_present_{{ group }}_{{ section }}_{{ member }}_absent:
  module_and_function: group.info
  args:
    - '{{ group }}'
  assertion: assertNotIn
  assertion_section: '{{ section }}'
  expected-return: '{{ member }}'
{%-       endfor %}
{%-     endfor %}

Debug log showing how the proposed changes work

Documentation checklist

Testing checklist

Additional context

saltstack-formulas-travis commented 4 years ago

:tada: This PR is included in version 0.48.3 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: