opscode/chef-metal — pull request #49 by carltonstedman (2014-04-29 16:04:19+00:00)
Title: re-raise Net::SCP error when fails to download

Current code simply does a "pass" when a SCP error occurs.

This is very confusing in some situations, for example, when using `machine_file` resource, if there is a "permission denied" error, the chef run should error out. Instead, it currently continues along silently, having simply failed to complete the SCP transfer.

With this update, when a Net::SCP::Error occurs and mentions "did not finish" in it's error message (as per Net::SCP 1.2.0 gem), it will re-raise the exception, causing chef run to fail (as desired).

Additionally, `ensure` is used to close the channel, whether or not exception happens.