PowerShell / PowerShell/DSC

dsc set command fails when using powershellgroup resources with json error

Open
#261 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
523
Forks
75
Avg merge
3d 16h
Merged PRs (30d)
24

Description

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 using dsc config set for a test powershellgroup resource, I get an error Operation: Failed to parse json from get pwsh|PSDscResources/MSFT_WindowsFeature. However, it then returns a valid json object so it is unclear why it is unable to parse the output.

Sample config code:
`# example.dsc.config.yaml
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
resources:

  • name: powershell-dsc-resources
    type: DSC/PowerShellGroup
    properties:
    resources:
    • name: DNS
      type: PSDscResources/MSFT_WindowsFeature
      properties:
      Name: DNS
      Ensure: Present
      `

And example output:
{ "IncludeAllSubFeature": false, "DisplayName": "DNS Server", "Name": "DNS", "Ensure": "Absent" }

When running dsc set the additional error details is Error: JSON: expected value at line 1 column 1

Expected behavior
dsc would set the configuration to match the yaml config file
Actual behavior
Error - Error: JSON: expected value at line 1 column 1
Error details
Error: JSON: expected value at line 1 column 1
Environment data
Name                           Value
----                           -----
PSVersion                      7.3.9
PSEdition                      Core
GitCommitId                    7.3.9
OS                             Microsoft Windows 10.0.20348
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Version

7.3.9

Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce dsc config set with the provided PowerShellGroup YAML and inspect the JSON parsing around the get pwsh|PSDscResources/MSFT_WindowsFeature operation. The work is done when the sample configuration applies successfully without the JSON: expected value at line 1 column 1 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.