Allow provisioner cleanup task to exit on failure

This commit is contained in:
Seth Vargo 2015-11-19 14:55:46 -08:00
parent 9bab741cf3
commit 609ff9f7b2
1 changed files with 14 additions and 1 deletions

View File

@ -145,7 +145,20 @@ module VagrantPlugins
command = "knife #{deletable} delete #{node_name}" command = "knife #{deletable} delete #{node_name}"
command << " --config '#{guest_client_rb_path}'" command << " --config '#{guest_client_rb_path}'"
command << " --yes" command << " --yes"
@machine.communicate.sudo(command, error_check: true)
output = []
result = @machine.communicate.sudo(command, error_check: false) do |_, data|
output << data
end
if result != 0
@machine.ui.error("There were errors removing the #{deletable} from the Chef Server:")
@machine.ui.error("")
@machine.ui.error(output.join("\n"))
@machine.ui.error("")
@machine.ui.error("Vagrant will continue destroying the virtual machine, but you may need")
@machine.ui.error("to manually delete the #{deletable} from the Chef Server!")
end
end end
end end
end end