PowerShell / PowerShell/DSC

config validate command needs to check for duplicate resource names in configuration document

Open
#842 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-StaticAnalysis Issue-Enhancement
Dominant language
Rust
Stars
523
Forks
75
Avg merge
3d 16h
Merged PRs (30d)
24

Description

Summary of the new feature / enhancement

In order to avoid errors at runtime, the dsc config validate should detect and provide appropriate error response when a resource name is duplicated in a configuration document.

Configuration:

{
"$schema": "https://aka.ms/dsc/schemas/v3/bundled/config/document.json",
"resources": [
{
"type": "Microsoft.Windows/Registry",
"name": "EnsureTest1Value",
"properties": {
"keyPath": "HKEY_LOCAL_MACHINE\SOFTWARE\TEST",
"valueName": "Test1",
"valueData": { "DWord": 1 },
"_exist": true
}
},
{
"type": "Microsoft.Windows/Registry",
"name": "EnsureTest2Value",
"properties": {
"keyPath": "HKEY_LOCAL_MACHINE\SOFTWARE\TEST",
"valueName": "Test2",
"valueData": { "String": "Hello World!" },
"_exist": true
}
},
{
"type": "Microsoft.Windows/Registry",
"name": "EnsureTest1Value",
"properties": {
"keyPath": "HKEY_LOCAL_MACHINE\SOFTWARE\TEST",
"valueName": "Test",
"valueData": { "String": "Hello World!" },
"_exist": false
}
}
]
}

This below should return false with a reason as duplicate resource name

dsc config validate --file C:\dsc\Demo1.json
valid: true
reason: null
Proposed technical implementation details (optional)

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

Start with the dsc config validate command and reproduce the configuration example from this issue. Verify that duplicate resource names produce valid: false with a reason identifying the duplicate, rather than valid: true and reason: null.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.