Skip to content
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: 'EnvironmentVariables' not idempotent #38

Open
General-Chaos opened this issue Jul 10, 2020 · 0 comments
Open

JeaRoleCapabilities: 'EnvironmentVariables' not idempotent #38

General-Chaos opened this issue Jul 10, 2020 · 0 comments

Comments

@General-Chaos
Copy link

When applying environment variables on JeaRoleCapabilities, the test is always false, no matter how I try and pass the variables.

Minimal reproduction, version 0.6.5:

$params =@{
    Path = "C:\Program Files\WindowsPowerShell\Modules\TestJEADSC\RoleCapabilities\test.psrc"
    VisibleCmdlets = @(
        'Get-Command',
        'Measure-Object'
    )
    EnvironmentVariables = @("@{'Test' = 'test'}")
}

Invoke-DscResource -Name JeaRoleCapabilities -Property $params -Method set -ModuleName JEADSC -Verbose

Invoke-DscResource -Name JeaRoleCapabilities -Property $params -Method test -ModuleName JEADSC -Verbose

Expectation : Test passes

Actual result:

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = Resourceset,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/D
esiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer COMPUTER with user sid <removed>.
VERBOSE: [COMPUTER]: LCM:  [ Start  Set      ]  [[JeaRoleCapabilities]DirectResourceAccess]
VERBOSE: [COMPUTER]: LCM:  [ End    Set      ]  [[JeaRoleCapabilities]DirectResourceAccess]  in 0.0160 seconds.
VERBOSE: [COMPUTER]: LCM:  [ End    Set      ]    in  0.0310 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.

RebootRequired 
-------------- 
False          
VERBOSE: Time taken for configuration job to complete is 0.094 seconds
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = Resourcetest,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/
DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer COMPUTER with user sid <removed>.
VERBOSE: [COMPUTER]: LCM:  [ Start  Test     ]  [[JeaRoleCapabilities]DirectResourceAccess]
VERBOSE: [COMPUTER]:                            [[JeaRoleCapabilities]DirectResourceAccess] Validating Path: C:\Program Files\WindowsPowerShell\Modules\TestJEADSC\RoleCapabilities\test.
psrc
VERBOSE: [COMPUTER]:                            [[JeaRoleCapabilities]DirectResourceAccess] Checking file extension is psrc for: C:\Program Files\WindowsPowerShell\Modules\TestJEADSC\Ro
leCapabilities\test.psrc
VERBOSE: [COMPUTER]:                            [[JeaRoleCapabilities]DirectResourceAccess] Checking parent forlder is RoleCapabilities for: C:\Program Files\WindowsPowerShell\Modules\T
estJEADSC\RoleCapabilities\test.psrc
VERBOSE: [COMPUTER]:                            [[JeaRoleCapabilities]DirectResourceAccess] Checking Folder is in PSModulePath is psrc for: C:\Program Files\WindowsPowerShell\Modules\Te
stJEADSC\RoleCapabilities\test.psrc
VERBOSE: [COMPUTER]:                            [[JeaRoleCapabilities]DirectResourceAccess] Path is a valid psrc path. Returning true.
VERBOSE: [COMPUTER]:                            [[JeaRoleCapabilities]DirectResourceAccess] Existing Configuration: {
    "EnvironmentVariables":  [
                                 "System.Collections.Hashtable"
                             ],
    "Path":  "C:\\Program Files\\WindowsPowerShell\\Modules\\TestJEADSC\\RoleCapabilities\\test.psrc",
    "VisibleCmdlets":  [
                           "Get-Command",
                           "Measure-Object"
                       ]
}
VERBOSE: [COMPUTER]:                            [[JeaRoleCapabilities]DirectResourceAccess] New COnfiguration: {
    "EnvironmentVariables":  [
                                 "@{\u0027Test\u0027 = \u0027test\u0027}"
                             ],
    "Path":  "C:\\Program Files\\WindowsPowerShell\\Modules\\TestJEADSC\\RoleCapabilities\\test.psrc",
    "VisibleCmdlets":  [
                           "Get-Command",
                           "Measure-Object"
                       ]
}
VERBOSE: [COMPUTER]: LCM:  [ End    Test     ]  [[JeaRoleCapabilities]DirectResourceAccess] False in 0.0470 seconds.
VERBOSE: [COMPUTER]: LCM:  [ End    Set      ]    in  0.0630 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.

InDesiredState : False

VERBOSE: Time taken for configuration job to complete is 0.116 seconds

Also the case when setting /testing from MOF. I have tried many different formats of the arg and cannot get it to work. I did notice that JeaSessionConfiguration implements 'EnvironmentVariables' differently and the comparison does work in that resource. Apologies if I am missing something obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant