dsccommunity / dsccommunity/NetworkingDsc
NetAdapterBinding: Use of State & CurrentState Properties is non-idiomatic
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 235
- Forks
- 93
- PR merge metrics
- No merged PRs in 30d
Description
Details of the scenario you tried and the problem that is occurring
The schema for the NetAdapterBinding Resource includes both State (writable enum) and CurrentState (read-only enum) for the same information on the Resource:
This runs counter to the idiomatic design of a DSC Resource which presumes that any property of a Resource which is stateful and ensurable have a single writable property for it and that this property be returned in Get-TargetResource.
The current implementation of Get-TargetResource returns both State and CurrentState, though those values may be different because State returns the value of the parameter passed to that function (defaults to Enabled) while CurrentState returns the actual state of the adapter binding.
Test-TargetResource does not utilize the Get-TargetResource function but instead reimplements the check and returns a boolean result.
Suggested solution to the issue
I suggest:
- Removing the
CurrentStateproperty entirely from the schema - Removing the
Stateparameter fromGet-TargetResource - Reworking
Get-TargetResourceto return the current state of the adapter binding forState
Version of the DSC module that was used ('dev' if using current dev branch)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with source/DSCResources/DSC_NetAdapterBinding/DSC_NetAdapterBinding.schema.mof and DSC_NetAdapterBinding.psm1, especially the schema properties and Get-TargetResource implementation linked in the issue. Done means CurrentState is removed, Get-TargetResource no longer accepts State, and State reports the adapter binding's current state while Test-TargetResource continues to return the correct result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- devops, networking
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100