summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2021-11-02 12:12:53 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2021-11-03 16:50:59 -0700
commit09b77eb5a184d19368174bf601078dbc12d05f48 (patch)
tree2da6a2c86fd58cccf18091c7eeeff740466906a2
parent317ec64303564a00d62104459cdaa08d19d1aa57 (diff)
downloadchef-09b77eb5a184d19368174bf601078dbc12d05f48.tar.gz
Revert back to positional parameters for the interpreter
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/mixin/powershell_exec.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/chef/mixin/powershell_exec.rb b/lib/chef/mixin/powershell_exec.rb
index 1975b36155..9a3d8e4598 100644
--- a/lib/chef/mixin/powershell_exec.rb
+++ b/lib/chef/mixin/powershell_exec.rb
@@ -106,9 +106,8 @@ class Chef
# @param interpreter [Symbol] the interpreter type, `:powershell` or `:pwsh`
# @param timeout [Integer, nil] timeout in seconds.
# @return [Chef::PowerShell] output
- def powershell_exec(script, options = {})
- timeout = options.fetch(:timeout, nil)
- case options.fetch(:interpreter, :powershell)
+ def powershell_exec(script, interpreter = :powershell, timeout: nil)
+ case interpreter
when :powershell
Chef::PowerShell.new(script, timeout: timeout)
when :pwsh
@@ -120,8 +119,8 @@ class Chef
# The same as the #powershell_exec method except this will raise
# Chef::PowerShell::CommandFailed if the command fails
- def powershell_exec!(script, options = {})
- cmd = powershell_exec(script, options)
+ def powershell_exec!(script, interpreter = :powershell, **options)
+ cmd = powershell_exec(script, interpreter, **options)
cmd.error!
cmd
end