WSManDsc icon indicating copy to clipboard operation
WSManDsc copied to clipboard

BREAKING: `WSManListener`: Convert to a Class Resource

Open dan-hughes opened this issue 1 year ago • 9 comments

Pull Request (PR) description

Convert WSManListener to a class resource Rename parameter DN to BaseDN

This Pull Request (PR) fixes the following issues

Contributes to #98 Fixes #89

Task list

  • [x] Added an entry to the change log under the Unreleased section of the file CHANGELOG.md. Entry should say what was changed and how that affects users (if applicable), and reference the issue being resolved (if applicable).
  • [x] Resource documentation added/updated in README.md.
  • [x] Resource parameter descriptions added/updated in README.md, schema.mof and comment-based help.
  • [x] Comment-based help added/updated.
  • [x] Localization strings added/updated in all localization files as appropriate.
  • [x] Examples appropriately added/updated.
  • [x] Unit tests added/updated. See DSC Community Testing Guidelines.
  • [x] Integration tests added/updated (where possible). See DSC Community Testing Guidelines.
  • [x] New/changed code adheres to DSC Community Style Guidelines.

This change is Reviewable

dan-hughes avatar Sep 18 '24 16:09 dan-hughes

Codecov Report

Attention: Patch coverage is 99.23077% with 1 line in your changes missing coverage. Please review.

Project coverage is 99%. Comparing base (6f4163d) to head (3d7e440). Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
source/Private/Find-Certificate.ps1 97% 1 Missing :warning:
Additional details and impacted files

Impacted file tree graph

@@         Coverage Diff          @@
##           main   #106    +/-   ##
====================================
+ Coverage    88%    99%   +11%     
====================================
  Files         3      7     +4     
  Lines       310    200   -110     
====================================
- Hits        274    199    -75     
+ Misses       36      1    -35     
Files with missing lines Coverage Δ
source/Classes/020.WSManListener.ps1 100% <100%> (ø)
.../DSCResources/DSC_WSManConfig/DSC_WSManConfig.psm1 100% <ø> (ø)
...DSC_WSManServiceConfig/DSC_WSManServiceConfig.psm1 100% <ø> (ø)
source/Private/Get-DefaultPort.ps1 100% <100%> (ø)
source/Private/Get-Listener.ps1 100% <100%> (ø)
source/prefix.ps1 100% <100%> (ø)
source/Private/Find-Certificate.ps1 97% <97%> (ø)

codecov[bot] avatar Sep 27 '24 16:09 codecov[bot]

@PlagueHO, finally ready to go.

dan-hughes avatar Nov 17 '24 17:11 dan-hughes

@johlju, is this something you can also look at please?

dan-hughes avatar Jan 04 '25 09:01 dan-hughes

Will do, later in the week or weekend. 😊

johlju avatar Jan 04 '25 10:01 johlju

Justa few comments. Heads up, there might be some issues with PowerShell Gallery - i trying to release a version before merging this breaking change, but it fails with random errors (re-run 3 times, failing on different module name each time): https://dev.azure.com/dsccommunity/WsManDsc/_build/results?buildId=9921&view=logs&j=d7ffe41d-f206-59ed-99c3-e44ba5bb1f40&t=e2ebcab5-cb94-5995-9070-3fa60620c9c4

johlju avatar Jan 12 '25 09:01 johlju

@johlju, this is ready for another review.

I reverted back to using an Enum on one of the DSC properties. It cannot be nullable, but if the Enum values begin at 1, when the class is initialized without a value it will be 0.

This really only impacts optional properties and especially when there is an assert check. I added some logic to test if any of the properties are Enums and value = 0 which means it was not set by the user and can be ignored.

It seems to work, I have a feeling there is something I've not thought about though...

dan-hughes avatar Jan 19 '25 12:01 dan-hughes

I will try to get on this next, as soon as I can. But there is a lot at regular work this week.

johlju avatar Jan 29 '25 16:01 johlju

That's fine. There is actually something I wanted to discuss/propose around DscResource.Base to enable the use of Enums for optional properties. I'll create a discussion in the correct repo.

dan-hughes avatar Jan 29 '25 17:01 dan-hughes

@johlju this is ready for review again. Uses new base class functionality and preview DocGenerator which has the class enhancements.

dan-hughes avatar Feb 15 '25 07:02 dan-hughes

/azp run

johlju avatar May 04 '25 09:05 johlju

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar May 04 '25 09:05 azure-pipelines[bot]

@dan-hughes this looks good too me, but was a long time since I was on this. Do you see anything to add/change before merge? Kicked off the tests again just to make sure merge will work.

johlju avatar May 04 '25 09:05 johlju

Not that I know of. I will raise as a separate PR if needs be.

dan-hughes avatar May 04 '25 10:05 dan-hughes