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

Update repo files + change .Common to a buildable module #219

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

dan-hughes
Copy link

@dan-hughes dan-hughes commented Jan 6, 2025

Pull Request (PR) description

Update the module files to the latest versions. Move functions from the HyperVDsc.Common module to separate Public/Private functions.

Fixed typo in one integration test that referenced old module name.

This Pull Request (PR) fixes the following issues

Task list

  • 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).
  • Resource documentation updated in the resource's README.md.
  • Resource parameter descriptions updated in schema.mof.
  • Comment-based help updated, including parameter descriptions.
  • Localization strings added/updated in all localization files as appropriate.
  • Examples appropriately added/updated.
  • Unit tests added/updated. See DSC Community Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Community Testing Guidelines.
  • New/changed code adheres to DSC Community Style Guidelines.

This change is Reviewable

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83%. Comparing base (6c0e583) to head (ab5d61f).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #219   +/-   ##
===================================
- Coverage    83%    83%   -1%     
===================================
  Files        11     10    -1     
  Lines      1441   1372   -69     
===================================
- Hits       1203   1143   -60     
+ Misses      238    229    -9     

@dan-hughes dan-hughes marked this pull request as ready for review January 6, 2025 15:16
@dan-hughes
Copy link
Author

@johlju

@dan-hughes dan-hughes changed the title Update repo files + remove .Common module Update repo files + split out .Common module Jan 7, 2025
Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments for discussion. Let me know what you think. 🙂

Reviewed 37 of 37 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dan-hughes)


source/Public/Get-VMHyperV.ps1 line 8 at r1 (raw file):

    Name of the Hyper-V virtual machine to return
#>
function Get-VMHyperV

If a user has another command with this name exported from another module this is gonna be a conflict. To avoid that we should probably prefix the public commands, e.g. Get-HyperVDscVM.

Same for other commands.

Code quote:

Get-VMHyperV

source/Public/ConvertFrom-TimeSpan.ps1 line 11 at r1 (raw file):

    Convert timespan into the total number of seconds, minutes, hours or days.
#>
function ConvertFrom-TimeSpan

Maybe this should be moved to DscResource.Common? But can be another PR.

If a user has another command with this name exported from another module this is gonna be a conflict. To avoid that we should probably prefix the public commands, e.g. ConvertFrom-HyperVDscTimeSpan.

By moving it to DscResource.Common and because the module is imported inside the HyperVDsc module scope we avoid conflicts even if not renamed... I think. 🤔

Same for ConvertTo-TimeSpan

Code quote:

ConvertFrom-TimeSpan

@dan-hughes
Copy link
Author

Added some comments for discussion. Let me know what you think. 🙂

Reviewed 37 of 37 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dan-hughes)

source/Public/Get-VMHyperV.ps1 line 8 at r1 (raw file):

    Name of the Hyper-V virtual machine to return
#>
function Get-VMHyperV

If a user has another command with this name exported from another module this is gonna be a conflict. To avoid that we should probably prefix the public commands, e.g. Get-HyperVDscVM.

Same for other commands.

Code quote:

Get-VMHyperV

source/Public/ConvertFrom-TimeSpan.ps1 line 11 at r1 (raw file):

    Convert timespan into the total number of seconds, minutes, hours or days.
#>
function ConvertFrom-TimeSpan

Maybe this should be moved to DscResource.Common? But can be another PR.

If a user has another command with this name exported from another module this is gonna be a conflict. To avoid that we should probably prefix the public commands, e.g. ConvertFrom-HyperVDscTimeSpan.

By moving it to DscResource.Common and because the module is imported inside the HyperVDsc module scope we avoid conflicts even if not renamed... I think. 🤔

Same for ConvertTo-TimeSpan

Code quote:

ConvertFrom-TimeSpan

I'm happy to do so, this is an obvious downside to the functions not being nested inside a module inside the Dsc module.

Is there a way of having a nested Sampler module that maybe is best of both worlds? e.g. still have HyperVDsc.Common but it has it's own build.yaml inside this repo?

@dan-hughes
Copy link
Author

Example of adding the module name as a suffix.

@dan-hughes dan-hughes changed the title Update repo files + split out .Common module Update repo files + change .Common to a buildable module Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants