Skip to content

Commit

Permalink
Merge pull request #261 from puppetlabs/cat-1617-fix_psmodule_load_path
Browse files Browse the repository at this point in the history
(CAT-1617) - Always load vendored module in PSModulePath
  • Loading branch information
gavindidrichsen authored Dec 12, 2023
2 parents 3f9f9e8 + 9906276 commit 44d1770
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,8 @@ def interpolate_variables(string)
modified_string
end

# Parses a resource definition (as from `invocable_resource`) and, if the resource is implemented
# as a PowerShell class, ensures the System environment variable for PSModulePath is munged to
# Parses a resource definition (as from `invocable_resource`) and
# ensures the System environment variable for PSModulePath is munged to
# include the vendored PowerShell modules. Due to a bug in PSDesiredStateConfiguration, class-based
# DSC Resources cannot be called via Invoke-DscResource by path, only by module name, *and* the
# module must be discoverable in the system-level PSModulePath. The postscript for invocation has
Expand All @@ -666,8 +666,6 @@ def interpolate_variables(string)
# @param resource [Hash] a hash with the information needed to run `Invoke-DscResource`
# @return [String] A multi-line string which sets the PSModulePath at the system level
def munge_psmodulepath(resource)
return unless resource[:dscmeta_resource_implementation] == 'Class'

vendor_path = resource[:vendored_modules_path].tr('/', '\\')
<<~MUNGE_PSMODULEPATH.strip
$UnmungedPSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath','machine')
Expand Down

0 comments on commit 44d1770

Please sign in to comment.