From 1cc78dc224677b9f2bf3a273199b53258722852e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 6 Aug 2014 11:07:09 -0700 Subject: [PATCH] provisioners/salt: use exit code to detect failure [GH-4304] --- CHANGELOG.md | 1 + plugins/provisioners/salt/provisioner.rb | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de12bc84a..e2ea25d77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/plugins/provisioners/salt/provisioner.rb b/plugins/provisioners/salt/provisioner.rb index fbaebadde..6225fd339 100644 --- a/plugins/provisioners/salt/provisioner.rb +++ b/plugins/provisioners/salt/provisioner.rb @@ -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