From 64176ec031c6afa95efdcc79a312c1f3cba10614 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 3 Jul 2024 15:53:58 -0700 Subject: [PATCH] Updated PS adapter --- powershell-adapter/psDscAdapter/psDscAdapter.psm1 | 7 ++----- powershell-adapter/psDscAdapter/win_psDscAdapter.psm1 | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/powershell-adapter/psDscAdapter/psDscAdapter.psm1 b/powershell-adapter/psDscAdapter/psDscAdapter.psm1 index aeceb960..4b30971e 100644 --- a/powershell-adapter/psDscAdapter/psDscAdapter.psm1 +++ b/powershell-adapter/psDscAdapter/psDscAdapter.psm1 @@ -408,11 +408,8 @@ function Invoke-DscOperation { $psVersion = $PSVersionTable.PSVersion.ToString() 'PowerShell version: ' + $psVersion | Write-DscTrace - $moduleVersion = Get-Module PSDesiredStateConfiguration | ForEach-Object Version - 'PSDesiredStateConfiguration module version: ' + $moduleVersion | Write-DscTrace - # get details from cache about the DSC resource, if it exists - $cachedDscResourceInfo = $dscResourceCache | Where-Object Type -EQ $DesiredState.adapted_dsc_type | ForEach-Object DscResourceInfo + $cachedDscResourceInfo = $dscResourceCache | Where-Object Type -EQ $DesiredState.type | ForEach-Object DscResourceInfo # if the resource is found in the cache, get the actual state if ($cachedDscResourceInfo) { @@ -477,7 +474,7 @@ function Invoke-DscOperation { } else { $dsJSON = $DesiredState | ConvertTo-Json -Depth 10 - $errmsg = 'Can not find type "' + $DesiredState.adapted_dsc_type + '" for resource "' + $dsJSON + '". Please ensure that Get-DscResource returns this resource type.' + $errmsg = 'Can not find type "' + $DesiredState.type + '" for resource "' + $dsJSON + '". Please ensure that Get-DscResource returns this resource type.' 'ERROR: ' + $errmsg | Write-DscTrace exit 1 } diff --git a/powershell-adapter/psDscAdapter/win_psDscAdapter.psm1 b/powershell-adapter/psDscAdapter/win_psDscAdapter.psm1 index 6bff546c..928c48a5 100644 --- a/powershell-adapter/psDscAdapter/win_psDscAdapter.psm1 +++ b/powershell-adapter/psDscAdapter/win_psDscAdapter.psm1 @@ -309,7 +309,7 @@ function Invoke-DscOperation { 'PSDesiredStateConfiguration module version: ' + $moduleVersion | Write-DscTrace # get details from cache about the DSC resource, if it exists - $cachedDscResourceInfo = $dscResourceCache | Where-Object Type -EQ $DesiredState.adapted_dsc_type | ForEach-Object DscResourceInfo + $cachedDscResourceInfo = $dscResourceCache | Where-Object Type -EQ $DesiredState.type | ForEach-Object DscResourceInfo # if the resource is found in the cache, get the actual state if ($cachedDscResourceInfo) { @@ -451,7 +451,7 @@ function Invoke-DscOperation { } else { $dsJSON = $DesiredState | ConvertTo-Json -Depth 10 - $errmsg = 'Can not find type "' + $DesiredState.adapted_dsc_type + '" for resource "' + $dsJSON + '". Please ensure that Get-DscResource returns this resource type.' + $errmsg = 'Can not find type "' + $DesiredState.type + '" for resource "' + $dsJSON + '". Please ensure that Get-DscResource returns this resource type.' 'ERROR: ' + $errmsg | Write-DscTrace exit 1 }