communicators/winrm: detect parse errors in powershell and error

/cc @sneal - Any better way to do this?
This commit is contained in:
Mitchell Hashimoto 2015-01-05 16:52:57 -08:00
parent 57e7633c4d
commit 79873cdb44
2 changed files with 17 additions and 0 deletions

View File

@ -17,6 +17,7 @@ BUG FIXES:
- commands/push: push lookups are by user-defined name, not push
strategy name [GH-4975]
- commands/push: validate the configuration
- communicators/winrm: detect parse errors in PowerShell and error
- guests/arch: fix network configuration due to poor line breaks. [GH-4964]
- guests/solaris: Merge configurations properly so configs can be set
in default Vagrantfiles. [GH-5092]

View File

@ -93,7 +93,23 @@ module VagrantPlugins
block.call(:stdout, out) if block_given? && out
block.call(:stderr, err) if block_given? && err
end
@logger.debug("Output: #{output.inspect}")
# Verify that we didn't get a parser error, and if so we should
# set the exit code to 1. Parse errors return exit code 0 so we
# need to do this.
if output[:exitcode] == 0
(output[:data] || []).each do |data|
next if !data[:stderr]
if data[:stderr].include?("ParserError")
@logger.warn("Detected ParserError, setting exit code to 1")
output[:exitcode] = 1
break
end
end
end
return output
end
end