1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fixed issue with multiple calls to Add-DeprecationWarning

This commit is contained in:
Matt Davis 2017-05-03 15:51:37 -07:00 committed by Matt Davis
parent 8c364f8f81
commit db91dd8685

View file

@ -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