From db91dd86850b70736c20112174ee2b74e0fc6b4a Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Wed, 3 May 2017 15:51:37 -0700 Subject: [PATCH] fixed issue with multiple calls to Add-DeprecationWarning --- lib/ansible/module_utils/powershell.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/powershell.ps1 b/lib/ansible/module_utils/powershell.ps1 index bc0caefd83..642d23cb42 100644 --- a/lib/ansible/module_utils/powershell.ps1 +++ b/lib/ansible/module_utils/powershell.ps1 @@ -113,7 +113,7 @@ Function Add-Warning($obj, $message) # so he does not have to check for the attribute prior to adding. Function Add-DeprecationWarning($obj, $message, $version = $null) { - if (Get-Member -InputObject $obj -Name "deprecations") { + if ($obj.ContainsKey("deprecations")) { if ($obj.deprecations -is [array]) { $obj.deprecations += @{ msg = $message @@ -123,7 +123,7 @@ Function Add-DeprecationWarning($obj, $message, $version = $null) throw "deprecations attribute is not a list" } } else { - $obj.deprecations = ,@( + $obj.deprecations = @( @{ msg = $message version = $version