provisioners/salt: use exit code to detect failure [GH-4304]

This commit is contained in:
Mitchell Hashimoto 2014-08-06 11:07:09 -07:00
parent 3bc5ecfbd0
commit 1cc78dc224
2 changed files with 4 additions and 3 deletions

View File

@ -15,6 +15,7 @@ IMPROVEMENTS:
- communicators/winrm: Show stdout/stderr if command fails. [GH-4094]
- guests/nixos: Added better NFS support. [GH-3983]
- providers/hyperv: Accept VHD disk format. [GH-4208]
- provisioners/salt: Get proper exit codes to detect failed runs. [GH-4304]
BUG FIXES:

View File

@ -302,7 +302,7 @@ module VagrantPlugins
@machine.env.ui.info "Calling state.highstate... (this may take a while)"
if @config.install_master
@machine.communicate.sudo("salt '*' saltutil.sync_all")
@machine.communicate.sudo("salt '*' state.highstate --verbose#{get_loglevel}#{get_colorize}#{get_pillar}") do |type, data|
@machine.communicate.sudo("salt '*' state.highstate --retcode-passthrough --verbose#{get_loglevel}#{get_colorize}#{get_pillar}") do |type, data|
if @config.verbose
@machine.env.ui.info(data)
end
@ -311,14 +311,14 @@ module VagrantPlugins
if @machine.config.vm.communicator == :winrm
opts = { elevated: true }
@machine.communicate.execute("C:\\salt\\salt-call.exe saltutil.sync_all", opts)
@machine.communicate.execute("C:\\salt\\salt-call.exe state.highstate #{get_loglevel}#{get_colorize}#{get_pillar}", opts) do |type, data|
@machine.communicate.execute("C:\\salt\\salt-call.exe state.highstate --retcode-passthrough #{get_loglevel}#{get_colorize}#{get_pillar}", opts) do |type, data|
if @config.verbose
@machine.env.ui.info(data)
end
end
else
@machine.communicate.sudo("salt-call saltutil.sync_all")
@machine.communicate.sudo("salt-call state.highstate #{get_loglevel}#{get_colorize}#{get_pillar}") do |type, data|
@machine.communicate.sudo("salt-call state.highstate --retcode-passthrough #{get_loglevel}#{get_colorize}#{get_pillar}") do |type, data|
if @config.verbose
@machine.env.ui.info(data)
end