Skip to content

Commit 44d1770

Browse files
Merge pull request #261 from puppetlabs/cat-1617-fix_psmodule_load_path
(CAT-1617) - Always load vendored module in PSModulePath
2 parents 3f9f9e8 + 9906276 commit 44d1770

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,8 @@ def interpolate_variables(string)
656656
modified_string
657657
end
658658

659-
# Parses a resource definition (as from `invocable_resource`) and, if the resource is implemented
660-
# as a PowerShell class, ensures the System environment variable for PSModulePath is munged to
659+
# Parses a resource definition (as from `invocable_resource`) and
660+
# ensures the System environment variable for PSModulePath is munged to
661661
# include the vendored PowerShell modules. Due to a bug in PSDesiredStateConfiguration, class-based
662662
# DSC Resources cannot be called via Invoke-DscResource by path, only by module name, *and* the
663663
# module must be discoverable in the system-level PSModulePath. The postscript for invocation has
@@ -666,8 +666,6 @@ def interpolate_variables(string)
666666
# @param resource [Hash] a hash with the information needed to run `Invoke-DscResource`
667667
# @return [String] A multi-line string which sets the PSModulePath at the system level
668668
def munge_psmodulepath(resource)
669-
return unless resource[:dscmeta_resource_implementation] == 'Class'
670-
671669
vendor_path = resource[:vendored_modules_path].tr('/', '\\')
672670
<<~MUNGE_PSMODULEPATH.strip
673671
$UnmungedPSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath','machine')

0 commit comments

Comments
 (0)