communicators/winrm: good_exit option

This commit is contained in:
Mitchell Hashimoto 2014-05-07 09:47:47 -07:00
parent 42453c1600
commit 882c9ad7f6
2 changed files with 9 additions and 3 deletions

View File

@ -14,6 +14,8 @@ BUG FIXES:
- commands/reload: If `--provision` is specified, force provisioning. [GH-3657]
- guests/redhat: Fix networking issues with CentOS. [GH-3649]
- guests/windows: Human error if WinRM not in use to configure networks. [GH-3651]
- guests/windows: Puppet exit code 2 doesn't cause Windows to raise
an error. [GH-3677]
- providers/docker: Show proper error message when on Linux. [GH-3654]
- providers/docker: Proxy VM works properly even if default provider
environmental variable set to "docker" [GH-3662]

View File

@ -57,14 +57,17 @@ module VagrantPlugins
return 0 if command.empty?
opts = {
command: command,
elevated: false,
error_check: true,
error_class: Errors::ExecutionError,
error_key: :execution_error,
command: command,
good_exit: 0,
shell: :powershell,
elevated: false
}.merge(opts || {})
opts[:good_exit] = Array(opts[:good_exit])
if opts[:elevated]
path = File.expand_path("../scripts/elevated_shell.ps1", __FILE__)
command = Vagrant::Util::TemplateRenderer.render(path, options: {
@ -121,7 +124,8 @@ module VagrantPlugins
def execution_output(output, opts)
if opts[:shell] == :wql
return output
elsif opts[:error_check] && output[:exitcode] != 0
elsif opts[:error_check] && \
!opts[:good_exit].include(output[:exitcode])
raise_execution_error(output, opts)
end
output[:exitcode]