hashicorp / hashicorp/packer

Add iso_timeout (or iso_download_timeout) option

Open
#12,684 2 comments 8 reactions 0 assignees View on GitHub
enhancement stage/waiting-on-upstream
Dominant language
Go
Stars
15.8k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

#### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

#### Description

If a network connection is interrupted during an ISO download (via HTTP/HTTPS) `packer` doesn't abort, it just sort of hangs indefinitely (from what I could tell, it would hang until the ETA is exhausted).

If a network connection is restored the download doesn't appear to resume either... so it's not retrying.

To simulate this I would start a download, and then stop/restart my VPN. I also tried simulating the issue by replacing the default route with one that would return a 'Destination Net Prohibited' error. There didn't appear to be a difference in either case.

#### Use Case(s)

If a network issue, or remote server interrupts a download, I'd like to control how quickly `packer` fails, and moves onto downloading the next ISO. My scripts will then retry the download failures at the end.

In that same vein, it would be nice if `packer` used a different exit code for ISO download failures, as opposed to always returning 1. For example returning a 5 if the download/checksum fails. That would make it easier to detect download issues, and differentiate them from syntax/build/post-processor errors.... perhaps leaving `1` for when multiple builds are being processed and they fail at different stages.

If your worried about backwards compatibility, this feature could be enabled via a CLI option and/or environment variable, such as `-extend-exit-codes` or `PACKER_EXTEND_CODES` ...

#### Potential configuration

```
curl -Lso packer-cache-x64.json https://raw.githubusercontent.com/lavabit/robox/49dc89d5a7e2cf3cfe9e33acb713b9ec72a2d9bb/generic-libvirt-x64.json
packer build -parallel-builds=1 -only=debian8-x64,opensuse15-x64 packer-cache-x64.json
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.