Fix up deprecated_aliases spot for PS (#66326)

This commit is contained in:
Jordan Borean 2020-01-10 11:44:15 +10:00 committed by GitHub
parent 3c0a836004
commit 7ed00a1560
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 37 deletions

View file

@ -685,9 +685,8 @@ namespace Ansible.Basic
if (parameters.Contains(alias)) if (parameters.Contains(alias))
parameters[k] = parameters[alias]; parameters[k] = parameters[alias];
} }
}
List<Hashtable> deprecatedAliases = (List<Hashtable>)argumentSpec["deprecated_aliases"]; List<Hashtable> deprecatedAliases = (List<Hashtable>)v["deprecated_aliases"];
foreach (Hashtable depInfo in deprecatedAliases) foreach (Hashtable depInfo in deprecatedAliases)
{ {
foreach (string keyName in new List<string> { "name", "version" }) foreach (string keyName in new List<string> { "name", "version" })
@ -707,6 +706,7 @@ namespace Ansible.Basic
Deprecate(FormatOptionsContext(msg, " - "), depVersion); Deprecate(FormatOptionsContext(msg, " - "), depVersion);
} }
} }
}
return aliasResults; return aliasResults;
} }
@ -1334,4 +1334,3 @@ namespace Ansible.Basic
} }
} }
} }

View file

@ -796,24 +796,16 @@ test_no_log - Invoked with:
"Deprecated aliases" = { "Deprecated aliases" = {
$spec = @{ $spec = @{
options = @{ options = @{
option1 = @{ type = "str"; aliases = "alias1" } option1 = @{ type = "str"; aliases = "alias1"; deprecated_aliases = @(@{name = "alias1"; version = "2.10"}) }
option2 = @{ type = "str"; aliases = "alias2" } option2 = @{ type = "str"; aliases = "alias2"; deprecated_aliases = @(@{name = "alias2"; version = "2.11"}) }
option3 = @{ option3 = @{
type = "dict" type = "dict"
options = @{ options = @{
option1 = @{ type = "str"; aliases = "alias1" } option1 = @{ type = "str"; aliases = "alias1"; deprecated_aliases = @(@{name = "alias1"; version = "2.10"}) }
option2 = @{ type = "str"; aliases = "alias2" } option2 = @{ type = "str"; aliases = "alias2"; deprecated_aliases = @(@{name = "alias2"; version = "2.11"}) }
} }
deprecated_aliases = @(
@{ name = "alias1"; version = "2.10" }
@{ name = "alias2"; version = "2.11" }
)
} }
} }
deprecated_aliases = @(
@{ name = "alias1"; version = "2.10" }
@{ name = "alias2"; version = "2.11" }
)
} }
$complex_args = @{ $complex_args = @{
@ -1666,13 +1658,12 @@ test_no_log - Invoked with:
option_key = @{ option_key = @{
type = "str" type = "str"
aliases = ,"alias_name" aliases = ,"alias_name"
}
}
deprecated_aliases = @( deprecated_aliases = @(
@{name = "alias_name"} @{name = "alias_name"}
) )
} }
}
}
$failed = $false $failed = $false
try { try {
@ -1701,16 +1692,14 @@ test_no_log - Invoked with:
sub_option_key = @{ sub_option_key = @{
type = "str" type = "str"
aliases = ,"alias_name" aliases = ,"alias_name"
}
}
deprecated_aliases = @( deprecated_aliases = @(
@{version = "2.10"} @{version = "2.10"}
) )
} }
} }
} }
}
}
$complex_args = @{ $complex_args = @{
option_key = @{ option_key = @{
@ -2578,3 +2567,4 @@ try {
} }
Exit-Module Exit-Module