parent
4f7938726e
commit
bcc09e10e6
|
@ -33,7 +33,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
tfile = Tempfile.new('vagrant-ssh')
|
tfile = Tempfile.new('vagrant-ssh')
|
||||||
remote_ext = shell == "powershell" ? "ps1" : "bat"
|
remote_ext = shell == "powershell" ? "ps1" : "bat"
|
||||||
remote_name = "C:\\Windows\\Temp\\#{File.basename(tfile.path)}.#{remote_ext}"
|
remote_name = "#{machine_config_ssh.upload_directory}\\#{File.basename(tfile.path)}.#{remote_ext}"
|
||||||
|
|
||||||
if shell == "powershell"
|
if shell == "powershell"
|
||||||
base_cmd = "powershell -File #{remote_name}"
|
base_cmd = "powershell -File #{remote_name}"
|
||||||
|
|
|
@ -4,9 +4,17 @@ module VagrantPlugins
|
||||||
module CommunicatorWinSSH
|
module CommunicatorWinSSH
|
||||||
class Config < VagrantPlugins::Kernel_V2::SSHConfig
|
class Config < VagrantPlugins::Kernel_V2::SSHConfig
|
||||||
|
|
||||||
|
attr_accessor :upload_directory
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
super
|
||||||
|
@upload_directory = UNSET_VALUE
|
||||||
|
end
|
||||||
|
|
||||||
def finalize!
|
def finalize!
|
||||||
@shell = "cmd" if @shell == UNSET_VALUE
|
@shell = "cmd" if @shell == UNSET_VALUE
|
||||||
@sudo_command = "%c" if @sudo_command == UNSET_VALUE
|
@sudo_command = "%c" if @sudo_command == UNSET_VALUE
|
||||||
|
@upload_directory = "C:\\Windows\\Temp" if @upload_directory == 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%"'
|
||||||
|
|
|
@ -22,7 +22,8 @@ describe VagrantPlugins::CommunicatorWinSSH::Communicator do
|
||||||
double("winssh",
|
double("winssh",
|
||||||
insert_key: false,
|
insert_key: false,
|
||||||
export_command_template: export_command_template,
|
export_command_template: export_command_template,
|
||||||
shell: 'cmd'
|
shell: 'cmd',
|
||||||
|
upload_directory: "C:\\Windows\\Temp"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
# Configuration mock
|
# Configuration mock
|
||||||
|
|
|
@ -161,3 +161,8 @@ config.winssh.export_command_template = '$env:%ENV_KEY%="%ENV_VALUE%"'
|
||||||
with `sudo`. This defaults to `%c` (assumes vagrant user is an administator
|
with `sudo`. This defaults to `%c` (assumes vagrant user is an administator
|
||||||
and needs no escalation). The `%c` will be replaced by the command that is
|
and needs no escalation). The `%c` will be replaced by the command that is
|
||||||
being executed.
|
being executed.
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
`config.winssh.upload_directory` - The upload directory used on the guest
|
||||||
|
to store scripts for execute. This is set to `C:\Windows\Temp` by default.
|
||||||
|
|
Loading…
Reference in New Issue