voxpupuli / puppet-wget

A puppet recipe for wget, a useful tool to download arbitary files from the web
Apache License 2.0
40 stars 114 forks source link

source_hash doesn't work with cache_dir #87

Open phillip-peach opened 7 years ago

phillip-peach commented 7 years ago

If you use cache_dir and the command generated to check the source_hash incorrectly tries to check it in the final destination before it is moved.

Since cache_dir is needed to work around #81 these two issues together mean you can't check the hash if mode needs to be changed to anything other than 0644.

Example Manifest snippet ` wget::fetch { '/usr/local/bin/ecs-cli': destination => '/usr/local/bin/ecs-cli', cache_dir => '/tmp', mode => '0755', source => 'https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-v0.6.1', #

SEE: https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-v0.6.1.md5

#
source_hash => 'c26236bdde9ad5df013d60137da0a239',

} Results in the following error, you can see the command incorrectly checking the final destination Error: wget --no-verbose -N -P "/tmp" "https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-v0.6.1" && echo 'c26236bdde9ad5df013d60137da0a239 /usr/local/bin/ecs-cli' | md5sum -c --quiet returned 1 instead of one of [0] Error: /Stage[main]/Aws::Ecscli/Wget::Fetch[/usr/local/bin/ecs-cli]/Exec[wget-/usr/local/bin/ecs-cli]/returns: change from notrun to 0 failed: wget --no-verbose -N -P "/tmp" "https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-v0.6.1" && echo 'c26236bdde9ad5df013d60137da0a239 /usr/local/bin/ecs-cli' | md5sum -c --quiet returned 1 instead of one of [0]`