Fix up deprecated_aliases spot for PS (#66326)
This commit is contained in:
parent
3c0a836004
commit
7ed00a1560
2 changed files with 26 additions and 37 deletions
|
@ -685,26 +685,26 @@ 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" })
|
|
||||||
{
|
{
|
||||||
if (!depInfo.ContainsKey(keyName))
|
foreach (string keyName in new List<string> { "name", "version" })
|
||||||
{
|
{
|
||||||
string msg = String.Format("{0} is required in a deprecated_aliases entry", keyName);
|
if (!depInfo.ContainsKey(keyName))
|
||||||
throw new ArgumentException(FormatOptionsContext(msg, " - "));
|
{
|
||||||
|
string msg = String.Format("{0} is required in a deprecated_aliases entry", keyName);
|
||||||
|
throw new ArgumentException(FormatOptionsContext(msg, " - "));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
string aliasName = (string)depInfo["name"];
|
||||||
string aliasName = (string)depInfo["name"];
|
string depVersion = (string)depInfo["version"];
|
||||||
string depVersion = (string)depInfo["version"];
|
|
||||||
|
|
||||||
if (parameters.Contains(aliasName))
|
if (parameters.Contains(aliasName))
|
||||||
{
|
{
|
||||||
string msg = String.Format("Alias '{0}' is deprecated. See the module docs for more information", aliasName);
|
string msg = String.Format("Alias '{0}' is deprecated. See the module docs for more information", aliasName);
|
||||||
Deprecate(FormatOptionsContext(msg, " - "), depVersion);
|
Deprecate(FormatOptionsContext(msg, " - "), depVersion);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1334,4 +1334,3 @@ namespace Ansible.Basic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,12 +1658,11 @@ test_no_log - Invoked with:
|
||||||
option_key = @{
|
option_key = @{
|
||||||
type = "str"
|
type = "str"
|
||||||
aliases = ,"alias_name"
|
aliases = ,"alias_name"
|
||||||
|
deprecated_aliases = @(
|
||||||
|
@{name = "alias_name"}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated_aliases = @(
|
|
||||||
@{name = "alias_name"}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$failed = $false
|
$failed = $false
|
||||||
|
@ -1701,13 +1692,11 @@ test_no_log - Invoked with:
|
||||||
sub_option_key = @{
|
sub_option_key = @{
|
||||||
type = "str"
|
type = "str"
|
||||||
aliases = ,"alias_name"
|
aliases = ,"alias_name"
|
||||||
|
deprecated_aliases = @(
|
||||||
|
@{version = "2.10"}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated_aliases = @(
|
|
||||||
@{version = "2.10"}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2578,3 +2567,4 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit-Module
|
Exit-Module
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue