Update public key cap to use powershell
This commit is contained in:
parent
852c549886
commit
ec9d23a531
@ -37,7 +37,7 @@ module VagrantPlugins
|
||||
|
||||
# Ensure the user's ssh directory exists
|
||||
remote_ssh_dir = "#{home_dir}\\.ssh"
|
||||
comm.create_remote_directory(remote_ssh_dir)
|
||||
comm.execute("New-Item -Path '#{remote_ssh_dir}' -ItemType directory -Force", shell: "powershell")
|
||||
remote_upload_path = "#{temp_dir}\\vagrant-insert-pubkey-#{Time.now.to_i}"
|
||||
remote_authkeys_path = "#{remote_ssh_dir}\\authorized_keys"
|
||||
|
||||
@ -67,7 +67,7 @@ module VagrantPlugins
|
||||
# @return [Hash] {:temp, :home}
|
||||
def self.fetch_guest_paths(communicator)
|
||||
output = ""
|
||||
communicator.execute("echo %TEMP%\necho %USERPROFILE%", shell: "cmd") do |type, data|
|
||||
communicator.execute("Write-Output $env:TEMP\nWrite-Output $env:USERPROFILE", shell: "powershell") do |type, data|
|
||||
if type == :stdout
|
||||
output << data
|
||||
end
|
||||
|
||||
@ -19,7 +19,7 @@ describe "VagrantPlugins::GuestWindows::Cap::InsertPublicKey" do
|
||||
allow(comm).to receive(:is_a?).and_return(true)
|
||||
allow(machine).to receive(:communicate).and_return(comm)
|
||||
|
||||
allow(comm).to receive(:execute).with(/echo .+/, shell: "cmd").and_yield(:stdout, "TEMP\r\nHOME\r\n")
|
||||
allow(comm).to receive(:execute).with(/Write .+/, shell: "powershell").and_yield(:stdout, "TEMP\r\nHOME\r\n")
|
||||
allow(comm).to receive(:execute).with(/dir .+\.ssh/, shell: "cmd")
|
||||
allow(comm).to receive(:execute).with(/dir .+authorized_keys/, shell: "cmd", error_check: false).and_return(auth_keys_check_result)
|
||||
allow(comm).to receive(:create_remote_directory)
|
||||
@ -65,7 +65,7 @@ describe "VagrantPlugins::GuestWindows::Cap::InsertPublicKey" do
|
||||
|
||||
context "when required directories cannot be fetched from the guest" do
|
||||
before do
|
||||
expect(comm).to receive(:execute).with(/echo .+/, shell: "cmd").and_yield(:stdout, "TEMP\r\n")
|
||||
expect(comm).to receive(:execute).with(/Write .+/, shell: "powershell").and_yield(:stdout, "TEMP\r\n")
|
||||
end
|
||||
|
||||
it "should raise an error" do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user