Skip to content

Commit

Permalink
win_group - fixed setting of group description in check_mode runs (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzvifriedman authored Aug 5, 2021
1 parent b9540df commit 4022e35
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelogs/fragments/260-description-checkmode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- win_group - fixed ``description`` setting for a group that doesn't exist when running in check_mode (https://github.com/ansible-collections/ansible.windows/pull/260).
2 changes: 1 addition & 1 deletion plugins/modules/win_group.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ try {

If ($null -ne $description) {
IF (-not $group.description -or $group.description -ne $description) {
$group.description = $description
If (-not $check_mode) {
$group.description = $description
$group.SetInfo()
}
$result.changed = $true
Expand Down
14 changes: 14 additions & 0 deletions tests/integration/targets/win_group/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@
that:
- "win_group_create_noname is failed"

- name: set a group description on a missing group in check mode
win_group:
name: "{{test_win_group_name}}"
description: "{{test_win_group_description}}"
check_mode: true
register: win_group_checkmode_description
ignore_errors: true

- name: check that description setting in check_mode passes if group doesn't exist
assert:
that:
- "win_group_checkmode_description is changed"
- "win_group_checkmode_description is not failed"

- name: create test group with invalid state parameter
win_group:
name: "{{test_win_group_name}}"
Expand Down

0 comments on commit 4022e35

Please sign in to comment.