sous-chefs / sous-chefs/github
Download failure leaves invalid file
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 25
- Forks
- 25
- Avg merge
- 5h 40m
- Merged PRs (30d)
- 1
Description
I just ran into an issue where Github failed to serve up a file properly, and that prevented all future runs of my cookbook from converging successfully.
The github_asset resource downloads directly into the destination file (/var/chef/cache/github_assets/org/repo/version/foo-version.tar.gz). If the download fails it leaves a zero-length archive behind with that name, and future cookbook runs don't re-download the file because the zero-length file exists. See https://github.com/reset/github-cookbook/blob/master/libraries/github_asset.rb#L94.
Suggested solution: download to a temporary file and rename it if the download completes successfully. I suggest downloading to a temporary name in the same directory so that the rename step doesn't also require a copy, if (for example) the /tmp directory is on a different volume than the /var/chef/cache/github_assets directory.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading libraries/github_asset.rb around line 94, where the download writes to the destination path. Verify the failure behavior and the existing resource flow, then ensure a failed download does not leave the destination archive while a successful download produces it through the temporary-file flow described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, ruby
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100