Merge pull request #8567 from chrisroberts/fix/winssh
Enable capabilities for winssh communicator
This commit is contained in:
commit
af5f943123
|
@ -19,6 +19,7 @@ module VagrantPlugins
|
||||||
}.merge(opts)
|
}.merge(opts)
|
||||||
|
|
||||||
sudo = opts[:sudo]
|
sudo = opts[:sudo]
|
||||||
|
shell = (opts[:shell] || machine_config_ssh.shell).to_s
|
||||||
|
|
||||||
@logger.info("Execute: #{command} (sudo=#{sudo.inspect})")
|
@logger.info("Execute: #{command} (sudo=#{sudo.inspect})")
|
||||||
exit_status = nil
|
exit_status = nil
|
||||||
|
@ -31,10 +32,10 @@ module VagrantPlugins
|
||||||
stderr_data_buffer = ''
|
stderr_data_buffer = ''
|
||||||
|
|
||||||
tfile = Tempfile.new('vagrant-ssh')
|
tfile = Tempfile.new('vagrant-ssh')
|
||||||
remote_ext = machine_config_ssh.shell.to_s == "powershell" ? "ps1" : "bat"
|
remote_ext = shell == "powershell" ? "ps1" : "bat"
|
||||||
remote_name = "C:\\Windows\\Temp\\#{File.basename(tfile.path)}.#{remote_ext}"
|
remote_name = "C:\\Windows\\Temp\\#{File.basename(tfile.path)}.#{remote_ext}"
|
||||||
|
|
||||||
if machine_config_ssh.shell.to_s == "powershell"
|
if shell == "powershell"
|
||||||
base_cmd = "powershell -File #{remote_name}"
|
base_cmd = "powershell -File #{remote_name}"
|
||||||
tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')
|
tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')
|
||||||
Remove-Item #{remote_name}
|
Remove-Item #{remote_name}
|
||||||
|
|
|
@ -9,10 +9,6 @@ module VagrantPlugins
|
||||||
@@logger = Log4r::Logger.new("vagrant::guest::windows::configure_networks")
|
@@logger = Log4r::Logger.new("vagrant::guest::windows::configure_networks")
|
||||||
|
|
||||||
def self.configure_networks(machine, networks)
|
def self.configure_networks(machine, networks)
|
||||||
if machine.config.vm.communicator != :winrm
|
|
||||||
raise Errors::NetworkWinRMRequired
|
|
||||||
end
|
|
||||||
|
|
||||||
@@logger.debug("Networks: #{networks.inspect}")
|
@@logger.debug("Networks: #{networks.inspect}")
|
||||||
|
|
||||||
guest_network = GuestNetwork.new(machine.communicate)
|
guest_network = GuestNetwork.new(machine.communicate)
|
||||||
|
|
|
@ -34,7 +34,7 @@ module VagrantPlugins
|
||||||
vm_provider_unc_path: vm_provider_unc_base + name,
|
vm_provider_unc_path: vm_provider_unc_base + name,
|
||||||
})
|
})
|
||||||
|
|
||||||
if machine.config.vm.communicator == :winrm
|
if machine.config.vm.communicator == :winrm || machine.config.vm.communicator == :winssh
|
||||||
machine.communicate.execute(script, shell: :powershell)
|
machine.communicate.execute(script, shell: :powershell)
|
||||||
else
|
else
|
||||||
# Convert script to double byte unicode string then base64 encode
|
# Convert script to double byte unicode string then base64 encode
|
||||||
|
|
|
@ -28,7 +28,7 @@ if( (Test-Path "$MountPoint") -and (Test-ReparsePoint "$MountPoint") )
|
||||||
}
|
}
|
||||||
elseif(Test-Path $MountPoint)
|
elseif(Test-Path $MountPoint)
|
||||||
{
|
{
|
||||||
Write-Debug "Mount point already exists and is not a symbolic link"
|
Write-Error "Mount point already exists and is not a symbolic link"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue