win_dsc - be more lenient with datetime parsing (#59703)

* win_dsc - be more lenient with datetime parsing

* Remove l that shouldn't be there
pull/59831/head
Jordan Borean 5 years ago committed by GitHub
parent 196347ff32
commit 04ec47bdf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- win_dsc - Be more leniant around the accepted DateTime values for backwards compatibility - https://github.com/ansible/ansible/issues/59667

@ -19,11 +19,7 @@ Function ConvertTo-ArgSpecType {
$arg_type = switch($CimType) { $arg_type = switch($CimType) {
Boolean { "bool" } Boolean { "bool" }
Char16 { [Func[[Object], [Char]]]{ [System.Char]::Parse($args[0].ToString()) } } Char16 { [Func[[Object], [Char]]]{ [System.Char]::Parse($args[0].ToString()) } }
DateTime { [Func[[Object], [DateTime]]]{ DateTime { [Func[[Object], [DateTime]]]{ [System.DateTime]($args[0].ToString()) } }
# o == ISO 8601 format
[System.DateTime]::ParseExact($args[0].ToString(), "o", [CultureInfo]::InvariantCulture,
[System.Globalization.DateTimeStyles]::None)
}}
Instance { "dict" } Instance { "dict" }
Real32 { "float" } Real32 { "float" }
Real64 { [Func[[Object], [Double]]]{ [System.Double]::Parse($args[0].ToString()) } } Real64 { [Func[[Object], [Double]]]{ [System.Double]::Parse($args[0].ToString()) } }

@ -54,8 +54,9 @@ options:
provided but a comma separated string also work. Use a list where provided but a comma separated string also work. Use a list where
possible as no escaping is required and it works with more complex types possible as no escaping is required and it works with more complex types
list C(CimInstance[]). list C(CimInstance[]).
- If the type of the DSC resource option is a C(DateTime), use a string in - If the type of the DSC resource option is a C(DateTime), you should use
the form of an ISO 8901 string. a string in the form of an ISO 8901 string to ensure the exact date is
used.
- Since Ansible 2.8, Ansible will now validate the input fields against the - Since Ansible 2.8, Ansible will now validate the input fields against the
DSC resource definition automatically. Older versions will silently DSC resource definition automatically. Older versions will silently
ignore invalid fields. ignore invalid fields.

Loading…
Cancel
Save