From 5b953581b4acf1159f110281debada28ba4e4820 Mon Sep 17 00:00:00 2001 From: Shachaf92 Date: Mon, 8 Jul 2019 00:13:48 +0300 Subject: [PATCH] win_domain_user - MAke the query user try catch block more accurate (#58782) * win_domain_user - MAke the query user try catch block more accurate for missing identity * change to minor_changes * Update win_domain_user-make-query-try-catch-accurate.yml * Update win_domain_user-make-query-try-catch-accurate.yml --- .../fragments/win_domain_user-make-query-try-catch-accurate.yml | 2 ++ lib/ansible/modules/windows/win_domain_user.ps1 | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/win_domain_user-make-query-try-catch-accurate.yml diff --git a/changelogs/fragments/win_domain_user-make-query-try-catch-accurate.yml b/changelogs/fragments/win_domain_user-make-query-try-catch-accurate.yml new file mode 100644 index 00000000000..fec682d636f --- /dev/null +++ b/changelogs/fragments/win_domain_user-make-query-try-catch-accurate.yml @@ -0,0 +1,2 @@ +minor_changes: +- "win_domain_user - Make the query user try catch block more accurate for missing identity (https://github.com/ansible/ansible/issues/57719)" diff --git a/lib/ansible/modules/windows/win_domain_user.ps1 b/lib/ansible/modules/windows/win_domain_user.ps1 index 4584f0c7384..d1d2ddabe75 100644 --- a/lib/ansible/modules/windows/win_domain_user.ps1 +++ b/lib/ansible/modules/windows/win_domain_user.ps1 @@ -80,7 +80,7 @@ if ($null -ne $domain_server) { try { $user_obj = Get-ADUser -Identity $username -Properties * @extra_args } -catch { +catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] { $user_obj = $null }