-
Notifications
You must be signed in to change notification settings - Fork 10
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
JeaRoleCapabilities Test always reeturns $false #19
Comments
Hi
I haven't seen that yet, I'll update my integration tests and run some manual tests to see if I can repro it.
I'd guess the problem is occurring in the Compare-Hashtable function if it's not returning correctly, probably on its comparison of scriptblocks.
…________________________________
From: Raimund Andrée [MSFT] <notifications@github.com>
Sent: Friday, December 28, 2018 11:57:16 AM
To: ChrisLGardner/JeaDsc
Cc: Subscribed
Subject: [ChrisLGardner/JeaDsc] JeaRoleCapabilities Test always reeturns $false (#19)
I am trying to create a Role Capabilities with the JeaRoleCapabilities resource. The resource's test method seems to return $false even if the Role Capabilities file exist with the requires settings. Can you repro this as well or is it me doing something wrong? I have put already a bit of time into this and should have a fix available soon if it is an issue with the code.
configuration JeaConfig1
{
Import-DscResource -ModuleName JeaDsc
node 'localhost'
{
JeaRoleCapabilities DscDiagnosticsRead
{
Path = 'C:\Program Files\WindowsPowerShell\Modules\JeaDsc\RoleCapabilities\DscDiagnosticsRead.psrc'
VisibleCmdlets = "@{ Name = 'Get-DscLocalConfigurationManager'; Parameters = @{ Name = '*' } }"
FunctionDefinitions = "@{ Name = 'Test'; ScriptBlock = { Test-DscConfiguration -Detailed } }", "@{ Name = 'GD'; ScriptBlock = { Get-Date } }"
VisibleFunctions = 'GD', 'Test'
}
}
}
JeaConfig1 -OutputPath c:\JeaTest
Start-DscConfiguration -Path C:\JeaTest -Verbose -Wait -Force
localhost.mof
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/
Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer RAANDREE0 with user sid S-1-5-21-3110595715-3530629690-4267244086-1001.
VERBOSE: [RAANDREE0]: LCM: [ Start Set ]
VERBOSE: [RAANDREE0]: LCM: [ Start Resource ] [[JeaRoleCapabilities]DscDiagnosticsRead]
VERBOSE: [RAANDREE0]: LCM: [ Start Test ] [[JeaRoleCapabilities]DscDiagnosticsRead]
VERBOSE: [RAANDREE0]: [[JeaRoleCapabilities]DscDiagnosticsRead] Validating Path: C:\Program Files\WindowsPowerShell\Modules\JeaDsc\RoleCapabilities\DscDiagn
osticsRead.psrc
VERBOSE: [RAANDREE0]: [[JeaRoleCapabilities]DscDiagnosticsRead] Checking file extension is psrc for: C:\Program Files\WindowsPowerShell\Modules\JeaDsc\RoleC
apabilities\DscDiagnosticsRead.psrc
VERBOSE: [RAANDREE0]: [[JeaRoleCapabilities]DscDiagnosticsRead] Checking parent forlder is RoleCapabilities for: C:\Program Files\WindowsPowerShell\Modules\
JeaDsc\RoleCapabilities\DscDiagnosticsRead.psrc
VERBOSE: [RAANDREE0]: [[JeaRoleCapabilities]DscDiagnosticsRead] Checking Folder is in PSModulePath is psrc for: C:\Program Files\WindowsPowerShell\Modules\J
eaDsc\RoleCapabilities\DscDiagnosticsRead.psrc
VERBOSE: [RAANDREE0]: [[JeaRoleCapabilities]DscDiagnosticsRead] Path is a valid psrc path. Returning true.
VERBOSE: [RAANDREE0]: LCM: [ End Test ] [[JeaRoleCapabilities]DscDiagnosticsRead] in 0.0330 seconds.
VERBOSE: [RAANDREE0]: LCM: [ Start Set ] [[JeaRoleCapabilities]DscDiagnosticsRead]
VERBOSE: [RAANDREE0]: LCM: [ End Set ] [[JeaRoleCapabilities]DscDiagnosticsRead] in 0.0410 seconds.
VERBOSE: [RAANDREE0]: LCM: [ End Resource ] [[JeaRoleCapabilities]DscDiagnosticsRead]
VERBOSE: [RAANDREE0]: LCM: [ End Set ]
VERBOSE: [RAANDREE0]: LCM: [ End Set ] in 0.2200 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 0.315 seconds
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#19>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AQDqFvmZ7r1UJGpKwEG8KB_OvDWuWo3uks5u9gccgaJpZM4ZjyEZ>.
|
The problem seem to be that New-PSRoleCapabilityFile slightly changes the format of scriptblocks. Hence the comparison always returns $false. If you can repro this with the code provided in my initial post, I will polish my changes and create a new PR. |
I'm seeing that same behaviour in my tests too. I'll do some debugging and see what I come up with but if you've got a PR then that would be great. |
So it definitely looks like the way the comparison is being done is the problem. |
This should now be fixed in master as I've started using the same approach as the session configuration and convert it to JSON and compare the strings. I'll get a release out to the gallery soon. |
This should be in 0.6.0 and above. 0.6.1 includes a small bug fix so I'd recommend that one or newer. |
Sorry, but does not seem to work. I am using version 0.6.4 and a config based on your DemoConfig.ps1. configuration Test1
{
Import-DscResource -Module JeaDsc
JeaRoleCapabilities DscDiagnosticsCapability
{
Path = 'C:\Program Files\WindowsPowerShell\Modules\JeaDsc\RoleCapabilities\DscDiagnostics.psrc'
VisibleCmdlets = "@{ Name = 'Restart-Service'; Parameters = @{ Name = 'Name'; ValidateSet = 'w32time' } }"
#FunctionDefinitions = "@{ Name = 'Test'; ScriptBlock = { Get-Date } }"
}
JeaSessionConfiguration Endpoint
{
EndpointName = "DscDiagnostics"
RoleDefinitions = "@{ 'G1' = @{ RoleCapabilities = 'DscDiagnostics' } }"
TranscriptDirectory = 'C:\ProgramData\Jea\DscDiagnostics'
DependsOn = '[JeaRoleCapabilities]DscDiagnosticsCapability'
}
}
Test1 -OutputPath d:\dsc
Start-DscConfiguration -Path d:\dsc -Wait -Verbose -Force The resource
If VisibleCmdlets is just a string array and not a hashtable as a string (like in #25), things work as expected. |
I am trying to create a Role Capabilities with the JeaRoleCapabilities resource. The resource's test method seems to return $false even if the Role Capabilities file exist with the requires settings. Can you repro this as well or is it me doing something wrong? I have put already a bit of time into this and should have a fix available soon if it is an issue with the code.
The text was updated successfully, but these errors were encountered: