Allow sudo wrapping but default to no-op
This commit is contained in:
parent
c56acfab94
commit
b35c68eacc
|
@ -20,7 +20,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
sudo = opts[:sudo]
|
sudo = opts[:sudo]
|
||||||
|
|
||||||
@logger.info("Execute: #{command}")
|
@logger.info("Execute: #{command} (sudo=#{sudo.inspect})")
|
||||||
exit_status = nil
|
exit_status = nil
|
||||||
|
|
||||||
# Open the channel so we can execute or command
|
# Open the channel so we can execute or command
|
||||||
|
@ -56,6 +56,9 @@ SCRIPT
|
||||||
upload(tfile.path, remote_name)
|
upload(tfile.path, remote_name)
|
||||||
tfile.delete
|
tfile.delete
|
||||||
|
|
||||||
|
base_cmd = shell_cmd(opts.merge(shell: base_cmd))
|
||||||
|
@logger.debug("Base SSH exec command: #{base_cmd}")
|
||||||
|
|
||||||
ch.exec(base_cmd) do |ch2, _|
|
ch.exec(base_cmd) do |ch2, _|
|
||||||
# Setup the channel callbacks so we can get data and exit status
|
# Setup the channel callbacks so we can get data and exit status
|
||||||
ch2.on_data do |ch3, data|
|
ch2.on_data do |ch3, data|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
require File.expand_path("../../../kernel_v2/config/ssh", __FILE__)
|
require File.expand_path("../../../kernel_v2/config/ssh", __FILE__)
|
||||||
|
|
||||||
|
# forward_x11 pty sudo_command
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommunicatorWinSSH
|
module CommunicatorWinSSH
|
||||||
class Config < VagrantPlugins::Kernel_V2::SSHConfig
|
class Config < VagrantPlugins::Kernel_V2::SSHConfig
|
||||||
|
|
||||||
def finalize!
|
def finalize!
|
||||||
@shell = "cmd" if @shell == UNSET_VALUE
|
@shell = "cmd" if @shell == UNSET_VALUE
|
||||||
@sudo_command = "cmd" if @sudo_command == UNSET_VALUE
|
@sudo_command = "%c" if @sudo_command == UNSET_VALUE
|
||||||
if @export_command_template == UNSET_VALUE
|
if @export_command_template == UNSET_VALUE
|
||||||
if @shell == "cmd"
|
if @shell == "cmd"
|
||||||
@export_command_template = 'set %ENV_KEY%="%ENV_VALUE%"'
|
@export_command_template = 'set %ENV_KEY%="%ENV_VALUE%"'
|
||||||
|
|
Loading…
Reference in New Issue