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

DSC/PowerShellGroup incorrect group inDesiredState #284

Open
3 tasks done
msftrubengu opened this issue Nov 21, 2023 · 0 comments
Open
3 tasks done

DSC/PowerShellGroup incorrect group inDesiredState #284

msftrubengu opened this issue Nov 21, 2023 · 0 comments

Comments

@msftrubengu
Copy link
Collaborator

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

When all the resources in a PowerShellGroup are in the desired state, the group's inDesired state property is false. Looking at the code, I think it is because dsc compares the desiredState with actualState, but in the case of a PowerShellGroup the results are always going to be a single element with InDesiredState or an array of with the resources InDesiredState. Maybe dsc has to special case this group's result.

Expected behavior

Group's inDesiredState should be true if all its resource are in the desired state.

Actual behavior

PS D:\Dev\DSC> dsc resource test -r DSC/PowerShellGroup -i '{ "resources": [ { "name": "test", "type": "xE2ETestResource/E2EFileResource", "properties": { "path": "D:\\Dev\\DscV3\\testv3.txt", "content": "test" } } ] }'
  2023-11-21T21:59:55.212660Z  INFO dsc_lib::dscresources::command_resource: Invoking test DSC/PowerShellGroup using pwsh
    at D:\Dev\DSC\dsc_lib\src\dscresources\command_resource.rs:232

desiredState:
  resources:
  - name: test
    type: xE2ETestResource/E2EFileResource
    properties:
      path: D:\Dev\DscV3\testv3.txt
      content: test
actualState:
  InDesiredState: false
inDesiredState: false
differingProperties:
- resources
PS D:\Dev\DSC> dsc resource set -r DSC/PowerShellGroup -i '{ "resources": [ { "name": "test", "type": "xE2ETestResource/E2EFileResource", "properties": { "path": "D:\\Dev\\DscV3\\testv3.txt", "content": "test" } } ] }'
  2023-11-21T22:00:40.620243Z  INFO dsc_lib::dscresources::command_resource: Getting current state for set by invoking get DSC/PowerShellGroup using pwsh
    at D:\Dev\DSC\dsc_lib\src\dscresources\command_resource.rs:132

  2023-11-21T22:00:49.253187Z  INFO dsc_lib::dscresources::command_resource: Invoking set DSC/PowerShellGroup using pwsh
    at D:\Dev\DSC\dsc_lib\src\dscresources\command_resource.rs:145

beforeState:
  Path: D:\Dev\DscV3\testv3.txt
  Ensure: Present
  Content: ''
afterState:
  RebootRequired: false
changedProperties:
- RebootRequired
PS D:\Dev\DSC> dsc resource test -r DSC/PowerShellGroup -i '{ "resources": [ { "name": "test", "type": "xE2ETestResource/E2EFileResource", "properties": { "path": "D:\\Dev\\DscV3\\testv3.txt", "content": "test" } } ] }'
  2023-11-21T22:01:11.628882Z  INFO dsc_lib::dscresources::command_resource: Invoking test DSC/PowerShellGroup using pwsh
    at D:\Dev\DSC\dsc_lib\src\dscresources\command_resource.rs:232

desiredState:
  resources:
  - name: test
    type: xE2ETestResource/E2EFileResource
    properties:
      path: D:\Dev\DscV3\testv3.txt
      content: test
actualState:
  InDesiredState: true
inDesiredState: false
differingProperties:
- resources

Error details

No response

Environment data

PS D:\Dev\DSC> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.3
PSEdition                      Core
GitCommitId                    7.3.3
OS                             Microsoft Windows 10.0.25999
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

v3.0.0-alpha.4

Visuals

No response

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

No branches or pull requests

2 participants