Skip to content

Commit

Permalink
Updated PS adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
anmenaga committed Jul 10, 2024
1 parent 9e7109a commit 55b152f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions powershell-adapter/psDscAdapter/psDscAdapter.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions powershell-adapter/psDscAdapter/win_psDscAdapter.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 55b152f

Please sign in to comment.