From 15fe061004a5dd8b14a38173bef1ea9572602e46 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 11 Apr 2014 21:27:54 -0700 Subject: [PATCH] provisioners/shell: cause provision_winrm if winrm --- plugins/provisioners/shell/provisioner.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/provisioners/shell/provisioner.rb b/plugins/provisioners/shell/provisioner.rb index 9dfffdf5b..1d844aca2 100644 --- a/plugins/provisioners/shell/provisioner.rb +++ b/plugins/provisioners/shell/provisioner.rb @@ -7,6 +7,18 @@ module VagrantPlugins module Shell class Provisioner < Vagrant.plugin("2", :provisioner) def provision + if @config.vm.communicator == :winrm + provision_winrm + else + provision_ssh + end + end + + protected + + # This is the provision method called if SSH is what is running + # on the remote end, which assumes a POSIX-style host. + def provision_ssh args = "" if config.args.is_a?(String) args = " #{config.args.to_s}" @@ -54,7 +66,11 @@ module VagrantPlugins end end - protected + # This provisions using WinRM, which assumes a PowerShell + # console on the other side. + def provision_winrm + # TODO + end # Quote and escape strings for shell execution, thanks to Capistrano. def quote_and_escape(text, quote = '"') @@ -68,7 +84,8 @@ module VagrantPlugins script = nil if config.remote? - download_path = @machine.env.tmp_path.join("#{@machine.id}-remote-script") + download_path = @machine.env.tmp_path.join( + "#{@machine.id}-remote-script") download_path.delete if download_path.file? Vagrant::Util::Downloader.new(config.path, download_path).download!