File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change 11require 'puppet/provider/exec'
2- begin
3- require 'ruby-pwsh'
4- rescue LoadError
5- raise 'Could not load the "ruby-pwsh" library; is the dependency module puppetlabs-pwshlib installed in this environment?'
6- end
72
83Puppet ::Type . type ( :exec ) . provide :powershell , :parent => Puppet ::Provider ::Exec do
94 confine :operatingsystem => :windows
10-
11- commands :powershell => Pwsh ::Manager . powershell_path
5+ confine :feature => :pwshlib
6+
7+ def self . powershell_path
8+ begin
9+ require 'ruby-pwsh'
10+ Pwsh ::Manager . powershell_path
11+ rescue
12+ nil
13+ end
14+ end
15+ commands :powershell => self . powershell_path
1216
1317 desc <<-EOT
1418 Executes Powershell commands. One of the `onlyif`, `unless`, or `creates`
Original file line number Diff line number Diff line change 11require 'puppet/provider/exec'
2- begin
3- require 'ruby-pwsh'
4- rescue LoadError
5- raise 'Could not load the "ruby-pwsh" library; is the dependency module puppetlabs-pwshlib installed in this environment?'
6- end
72
83Puppet ::Type . type ( :exec ) . provide :pwsh , :parent => Puppet ::Provider ::Exec do
4+ confine :feature => :pwshlib
5+
96 desc <<-EOT
107 Executes PowerShell Core commands. One of the `onlyif`, `unless`, or `creates`
118 parameters should be specified to ensure the command is idempotent.
You can’t perform that action at this time.
0 commit comments