Skip to content

Download failure leaves invalid file #9

@webcoyote

Description

@webcoyote

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions