-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export multi methods #579
base: main
Are you sure you want to change the base?
Export multi methods #579
Conversation
This reverts commit 9443e1c.
@SteveL-MSFT Hi Steve, I was actually a bit suprised my change broke the build. The reason is, after debugging and checking out the history on #556, I'm doubting if the change there was fully tested. If I add the following line in the if ($DesiredState.properties)
{
# set each property of $dscResourceInstance to the value of the property in the $desiredState INPUT object
$DesiredState.properties.psobject.properties | ForEach-Object -Process {
$dscResourceInstance.$($_.Name) = $_.Value
}
}
($dscResourceInstance | ConvertTo-Json -Depth 10 -Compress) | Write-DscTrace -Operation Trace I could see this: Clearly the properties are added to the output result set. That's why the tests are failing. Shouldn't these be filtered out? |
The diagnostic code is checking the wrong thing; 'filtering out' is done by constructing a new hashtable result object. Similarly for 'Export' operation - |
@@ -484,8 +484,14 @@ function Invoke-DscOperation { | |||
$addToActualState.properties = [psobject]@{'InDesiredState'=$Result} | |||
} | |||
'Export' { | |||
$t = $dscResourceInstance.GetType() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not remove this line;
otherwise $t
is $null
and you get You cannot call a method on a null-valued expression.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was a bit too aggressive on the removal. The line is added and the test should be working. I shouldn't have made such hasty assumptions. Do you mind running it once again?
PR Summary
Address issue #578. Additional class can be added if needed to have only one export method.
PR Context