Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up AD attribute checks for falsey values #38

Merged
merged 2 commits into from
May 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/group-domainlocal-scopeinfo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- >-
group - Fix idempotency check when ``scope: domainlocal`` is set - https://github.com/ansible-collections/microsoft.ad/issues/31
2 changes: 1 addition & 1 deletion plugins/module_utils/_ADObject.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ Function Compare-AnsibleADIdempotentList {
)

# It's easier to compare with strings.
$existingString = [string[]]@(if ($Existing) { $Existing | ForEach-Object ToString })
$existingString = [string[]]@(if ($null -ne $Existing) { $Existing | ForEach-Object ToString })
$comparer = if ($CaseInsensitive) {
[System.StringComparer]::OrdinalIgnoreCase
}
Expand Down
24 changes: 24 additions & 0 deletions tests/integration/targets/group/tasks/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,30 @@
- group_custom_actual.objects[0].sAMAccountName == "GroupSAM"
- group_custom_actual.objects[0].wWWHomePage == "www.ansible.com"

- name: create group with custom options - idempotent
group:
name: MyGroup
state: present
path: '{{ ou_info.distinguished_name }}'
display_name: My Display Name
description: My Description
scope: domainlocal
category: distribution
homepage: www.ansible.com
managed_by: CN=Domain Admins,CN=Users,{{ setup_domain_info.output[0].defaultNamingContext }}
members:
add:
- my_user_1
- '{{ test_users.results[1].object_guid }}'
- '{{ test_users.results[2].sid }}'
sam_account_name: GroupSAM
register: group_custom_again

- name: assert create group with custom options - idempotent
assert:
that:
- group_custom_again is not changed

- name: edit group
group:
name: MyGroup
Expand Down