hashicorp / packer-plugin-vagrant

Packer plugin for Vagrant
https://packer.io
Mozilla Public License 2.0
13 stars 24 forks source link

Fix driver return code handling #113

Closed lbajolet-hashicorp closed 4 months ago

lbajolet-hashicorp commented 4 months ago

When executing a Vagrant command, the driver would never error, unless the call to Start actually errored. This is problematic, as when there's a problem with a Vagrant command, it doesn't get forwarded to the caller, and no error might be reported.

This problem stems from a modification in commit b0c799cf599e449ff3d09, which changed how the command was invoked, as previously it used Run() (a combination of Start and Wait), and now it split both calls in two so the outputs of the command can be processed before sending them back. However, that change did not account for errors in Wait, which is where the process actually returns an error if it ends with a non-zero error code, making all commands from vagrant not report their errors to the driver.

Related to: #110