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))
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 (string keyName in new List<string> { "name", "version" })
@ -707,6 +706,7 @@ namespace Ansible.Basic
Deprecate(FormatOptionsContext(msg, " - "), depVersion);
}
}
}
return aliasResults;
}
@ -1334,4 +1334,3 @@ namespace Ansible.Basic
}
}
}

View file

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