Skip to content

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

Merged
aboe76 merged 1 commit intosaltstack-formulas:masterfrom
myii:fix/ensure-addusers-and-delusers-are-lists
Nov 2, 2019
Merged

fix(pillars): ensure addusers & delusers are lists#215
aboe76 merged 1 commit intosaltstack-formulas:masterfrom
myii:fix/ensure-addusers-and-delusers-are-lists

Conversation

@myii
Copy link
Copy Markdown
Contributor

@myii myii commented Nov 2, 2019

PR progress checklist (to be filled in by reviewers)

  • Changes to documentation are appropriate (or tick if not required)
  • Changes to tests are appropriate (or tick if not required)
  • Reviews completed

What type of PR is this?

Primary type

  • [build] Changes related to the build system
  • [chore] Changes to the build process or auxiliary tools and libraries such as documentation generation
  • [ci] Changes to the continuous integration configuration
  • [feat] A new feature
  • [fix] A bug fix
  • [perf] A code change that improves performance
  • [refactor] A code change that neither fixes a bug nor adds a feature
  • [revert] A change used to revert a previous commit
  • [style] Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)

Secondary type

  • [docs] Documentation changes
  • [test] Adding missing or correcting existing tests

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.

users_group_present_{{ group }}:
group.present:
- name: {{ group }}
- gid: {{ setting.get('gid', "null") }}
- system: {{ setting.get('system',"False") }}
- members: {{ setting.get('members')|json }}
- addusers: {{ setting.get('addusers')|json }}
- delusers: {{ setting.get('delusers')|json }}

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

  • Updated the README (e.g. Available states).
  • Updated pillar.example.

Testing checklist

  • Included in Kitchen (i.e. under state_top).
  • Covered by new/existing tests (e.g. InSpec, Serverspec, etc.).
  • Updated the relevant test pillar.

Additional context

@aboe76 aboe76 merged commit 48ab727 into saltstack-formulas:master Nov 2, 2019
@myii myii deleted the fix/ensure-addusers-and-delusers-are-lists branch November 2, 2019 09:36
@saltstack-formulas-travis
Copy link
Copy Markdown

🎉 This PR is included in version 0.48.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants