mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
A few win_dsc bugfixes (#25852)
This commit is contained in:
parent
74f6b64fb0
commit
911f4d3eb1
1 changed files with 15 additions and 2 deletions
|
@ -92,7 +92,16 @@ if (!$Resource)
|
|||
#Get the Module that provides the resource. Will be used as
|
||||
#mandatory argument for Invoke-DscResource
|
||||
$Module = $Resource.ModuleName
|
||||
$result["module_version"] = $Module.Version.ToString()
|
||||
|
||||
#grab the module version if we can
|
||||
try {
|
||||
if ($Resource.Module.Version)
|
||||
{
|
||||
$result["module_version"] = $Resource.Module.Version.ToString()
|
||||
}
|
||||
}
|
||||
catch {}
|
||||
|
||||
|
||||
#Convert params to correct datatype and inject
|
||||
$attrib.Keys | foreach-object {
|
||||
|
@ -221,9 +230,13 @@ try
|
|||
if ($check_mode -eq $False)
|
||||
{
|
||||
$SetResult = Invoke-DscResource -Method Set @Config -ModuleName $Module -ErrorVariable SetError -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
|
||||
if ($SetError -and ($SetResult -eq $null))
|
||||
{
|
||||
#If SetError was filled, throw to exit out of the try/catch loop
|
||||
throw $SetError
|
||||
}
|
||||
$result["reboot_required"] = $SetResult.RebootRequired
|
||||
}
|
||||
|
||||
$result["changed"] = $true
|
||||
if ($SetError)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue