-
Notifications
You must be signed in to change notification settings - Fork 30
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
Allow module without version #600
base: main
Are you sure you want to change the base?
Conversation
@SteveL-MSFT I know you have a ton on your plate, but hopefully you have some time to check out this small change. If you want me to add a test, I can make a duplicate of the TestClassResource. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test
Tests have been included. If you need it in the config, let me know, thought I don't believe it is needed. |
$containsDSCResource = select-string -LiteralPath $psd1 -pattern '^[^#]*\bDscResourcesToExport\b.*' | ||
if($null -ne $containsDSCResource) | ||
{ | ||
$moduleFolders = Get-ChildItem $folder -Directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's not clear to me is why the original code didn't just use Get-Module -ListAvailable
instead of parsing PSModulePath and replicating some of that logic. @anmenaga ?
PR Summary
Allow modules that don't have a version directory to be added in
$env:PSModulePath
.PR Context
The
Get-DscResourceModules
function scans the$env:PSModulePath
to find relevant modules to be included in the cache. When a module doesn't have a version directory, it does not find the module. This change allows the ability to include modules that don't contain the directory.I added this change because it can be useful for testing purposes to see the participation of DSC resources when developing them. For example, take the
winget-dsc
repository. Simply adding the resource to the environment variable adds it for participation.