Skip to content

Commit

Permalink
Updated PS and WMI adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
anmenaga committed Jul 10, 2024
1 parent 6077859 commit 9e7109a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions powershell-adapter/psDscAdapter/psDscAdapter.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ function Get-DscResourceObject {
}
else {
# mimic a config object with a single resource
$type = $inputObj.type
$inputObj.psobject.properties.Remove('type')
$type = $inputObj.adapted_dsc_type
$inputObj.psobject.properties.Remove('adapted_dsc_type')
$desiredState += [dscResourceObject]@{
name = $adapterName
type = $type
Expand Down Expand Up @@ -412,7 +412,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.type | ForEach-Object DscResourceInfo
$cachedDscResourceInfo = $dscResourceCache | Where-Object Type -EQ $DesiredState.adapted_dsc_type | ForEach-Object DscResourceInfo

# if the resource is found in the cache, get the actual state
if ($cachedDscResourceInfo) {
Expand Down Expand Up @@ -477,7 +477,7 @@ function Invoke-DscOperation {
}
else {
$dsJSON = $DesiredState | ConvertTo-Json -Depth 10
$errmsg = 'Can not find type "' + $DesiredState.type + '" for resource "' + $dsJSON + '". Please ensure that Get-DscResource returns this resource type.'
$errmsg = 'Can not find type "' + $DesiredState.adapted_dsc_type + '" for resource "' + $dsJSON + '". Please ensure that Get-DscResource returns this resource type.'
'ERROR: ' + $errmsg | Write-DscTrace
exit 1
}
Expand Down
8 changes: 4 additions & 4 deletions powershell-adapter/psDscAdapter/win_psDscAdapter.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ function Get-DscResourceObject {
}
else {
# mimic a config object with a single resource
$type = $inputObj.type
$inputObj.psobject.properties.Remove('type')
$type = $inputObj.adapted_dsc_type
$inputObj.psobject.properties.Remove('adapted_dsc_type')
$desiredState += [dscResourceObject]@{
name = $adapterName
type = $type
Expand Down 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.type | ForEach-Object DscResourceInfo
$cachedDscResourceInfo = $dscResourceCache | Where-Object Type -EQ $DesiredState.adapted_dsc_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.type + '" for resource "' + $dsJSON + '". Please ensure that Get-DscResource returns this resource type.'
$errmsg = 'Can not find type "' + $DesiredState.adapted_dsc_type + '" for resource "' + $dsJSON + '". Please ensure that Get-DscResource returns this resource type.'
'ERROR: ' + $errmsg | Write-DscTrace
exit 1
}
Expand Down
2 changes: 1 addition & 1 deletion wmi-adapter/wmi.resource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ elseif ($Operation -eq 'Get')
}
else # we are processing an individual resource call
{
$type_fields = $inputobj_pscustomobj.type -split "/"
$type_fields = $inputobj_pscustomobj.adapted_dsc_type -split "/"
$wmi_namespace = $type_fields[0].Replace('.','\')
$wmi_classname = $type_fields[1]

Expand Down

0 comments on commit 9e7109a

Please sign in to comment.