Update shell provisioner for powershell to add "shell_args", saner defaults and more useful detail in logging output; Add Eclipse .project file to .gitignore IDE section

This commit is contained in:
Eris Belew 2014-09-23 12:46:25 -07:00
parent 6747f12951
commit 7a73f5bd7c
4 changed files with 17 additions and 4 deletions

1
.gitignore vendored
View File

@ -31,6 +31,7 @@ doc/
# IDE junk
.idea/*
*.iml
.project
# Ruby Managers
.rbenv

View File

@ -10,6 +10,7 @@ module VagrantPlugins
attr_accessor :privileged
attr_accessor :binary
attr_accessor :keep_color
attr_accessor :shell_args
def initialize
@args = UNSET_VALUE
@ -19,6 +20,7 @@ module VagrantPlugins
@privileged = UNSET_VALUE
@binary = UNSET_VALUE
@keep_color = UNSET_VALUE
@shell_args = UNSET_VALUE
end
def finalize!
@ -29,6 +31,7 @@ module VagrantPlugins
@privileged = true if @privileged == UNSET_VALUE
@binary = false if @binary == UNSET_VALUE
@keep_color = false if @keep_color == UNSET_VALUE
@shell_args = "-ExecutionPolicy Bypass" if @shell_args == UNSET_VALUE
if @args && args_valid?
@args = @args.is_a?(Array) ? @args.map { |a| a.to_s } : @args.to_s

View File

@ -100,14 +100,22 @@ module VagrantPlugins
exec_path.gsub!('/', '\\')
exec_path = "c:#{exec_path}" if exec_path.start_with?("\\")
# For PowerShell scripts bypass the execution policy
# Copy shell_args from configuration
shell_args = config.shell_args
# For PowerShell scripts bypass the execution policy unless already specified
shell_args += " -ExecutionPolicy Bypass" if config.shell_args !~ /[-\/]ExecutionPolicy/i
# CLIXML output is kinda useless, especially on non-windows hosts
shell_args += " -OutputFormat Text" if config.shell_args !~ /[-\/]OutputFormat/i
command = "#{exec_path}#{args}"
command = "powershell -executionpolicy bypass -file #{command}" if
command = "powershell #{shell_args.to_s} -file #{command}" if
File.extname(exec_path).downcase == '.ps1'
if config.path
@machine.ui.detail(I18n.t("vagrant.provisioners.shell.running",
script: exec_path))
@machine.ui.detail(I18n.t("vagrant.provisioners.shell.runningas",
local: config.path.to_s, remote: exec_path))
else
@machine.ui.detail(I18n.t("vagrant.provisioners.shell.running",
script: "inline PowerShell script"))

View File

@ -1773,6 +1773,7 @@ en:
path_and_inline_set: "Only one of `path` or `inline` may be set."
path_invalid: "`path` for shell provisioner does not exist on the host system: %{path}"
running: "Running: %{script}"
runningas: "Running: %{local} as %{remote}"
upload_path_not_set: "`upload_path` must be set for the shell provisioner."
ansible: