Commit 1e6cb724 authored by Volker Hilsheimer's avatar Volker Hilsheimer
Browse files

Fix problems when using the WinSSH communicator

That communicator doesn't upload to Documents, but to the home directory
like the normal ssh communicator. Adjust paths accordingly. Also make
sure target paths exist.
parent 4afadfec
......@@ -547,7 +547,12 @@ module Minicoin
end
@vm.ui.info "Uploading '#{@job.path}'"
@vm.communicate.upload(@job.path, @target_path)
if @vm.communicate.class.name.include?("WinSSH")
@vm.communicate.execute("mkdir Documents\\#{@target_path}")
@vm.communicate.upload(@job.path, "Documents\\#{@target_path}")
else
@vm.communicate.upload(@job.path, @target_path)
end
run_command += "#{script_file}"
job_config = jobconfig(options)
......
......@@ -13,7 +13,8 @@ module Minicoin
end
def self.upload_key(machine)
if machine.config.vm.guest == :windows
mutagen_key_destination = "..\\.ssh\\#{$USER}.pub"
mutagen_key_destination = ".ssh\\#{$USER}.pub"
mutagen_key_destination = "..\\#{mutagen_key_destination}" if machine.config.vm.communicator == :winrm
mutagen_key_add = "Get-Content -Path $env:USERPROFILE\\.ssh\\#{$USER}.pub | Add-Content -Path $env:USERPROFILE\\.ssh\\authorized_keys -Encoding utf8"
else
mutagen_key_destination = ".ssh/#{$USER}.pub"
......@@ -22,7 +23,8 @@ module Minicoin
begin
machine.communicate.upload(SyncedFolderMutagen.public_key(), mutagen_key_destination)
machine.communicate.execute(mutagen_key_add)
rescue
rescue => e
machine.ui.error "Failed to authorize host key: #{e}"
raise Minicoin::Errors::NoSshKey
end
end
......
......@@ -141,10 +141,14 @@ def share_folders(box, machine, shares)
unless default_shares.include?($PWD) || default_shares.include?(".")
box.vm.synced_folder ".", "/opt/minicoin", disabled: true
if box.vm.guest == :windows
box.vm.provision "minicoin guest scripts:script",
type: :shell,
inline: "mkdir C:\\opt\\minicoin\\util",
upload_path: "/tmp/vagrant-shell_minicoin_guest_scripts"
box.vm.provision "minicoin guest scripts:upload",
type: :file,
source: "./util",
destination: "C:\\opt\\minicoin\\"
destination: "C:\\opt\\minicoin\\util"
else
box.vm.provision "minicoin guest scripts:script",
type: :shell,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment