rodjek/librarian-puppet — pull request #168 by jabley (2014-01-17 10:16:37+00:00)
Title: Make download of tarballs more robust

Prevents 500 / 504 responses being ignored, which I was seeing when using boxen.

Symptom:

```
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1414:in `fu_each_src_dest0': undefined method `to_str' for nil:NilClass (NoMethodError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1400:in `fu_each_src_dest'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:423:in `cp_r'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/lib/librarian/puppet/source/githubtarball.rb:64:in `install_version!'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/lib/librarian/puppet/source/githubtarball.rb:261:in `install!'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/vendor/librarian/lib/librarian/manifest.rb:191:in `install!'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/vendor/librarian/lib/librarian/action/install.rb:49:in `install_manifests'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/vendor/librarian/lib/librarian/action/install.rb:48:in `each'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/vendor/librarian/lib/librarian/action/install.rb:48:in `install_manifests'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/vendor/librarian/lib/librarian/action/install.rb:39:in `perform_installation'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/vendor/librarian/lib/librarian/action/install.rb:12:in `run'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/vendor/librarian/lib/librarian/cli.rb:157:in `install!'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/lib/librarian/puppet/cli.rb:64:in `install'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/thor-0.18.1/lib/thor/command.rb:27:in `__send__'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/vendor/librarian/lib/librarian/cli.rb:29:in `bin!'
from /opt/boxen/repo/.bundle/ruby/1.8/gems/librarian-puppet-0.9.10/bin/librarian-puppet:9
from /opt/boxen/repo/bin/librarian-puppet:16:in `load'
from /opt/boxen/repo/bin/librarian-puppet:16
Can't run Puppet, fetching dependencies with librarian failed.
```

and

```
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.
```

Checking what had actually been downloaded:

```shell
$ find /opt/boxen/vendor/puppet/cache/ -name '*.tar.gz' -type f -exec file {} \; | grep -v gzip
./vendor/puppet/cache/boxen-puppet-flux-1.0.0.tar.gz: ASCII text
./vendor/puppet/cache/boxen-puppet-homebrew-1.6.0.tar.gz: ASCII text
./vendor/puppet/cache/boxen-puppet-macvim-1.0.0.tar.gz: ASCII text
./vendor/puppet/cache/boxen-puppet-vim-1.0.5.tar.gz: ASCII text
./vendor/puppet/cache/dieterdemeyer-puppet-adium-1.3.0.tar.gz
./vendor/puppet/cache/geetarista-puppet-mplayerx-1.0.0.tar.gz: ASCII text
```

Looking at one of those:

```shell
$ cat /opt/boxen/repo/vendor/puppet/cache/dieterdemeyer-puppet-adium-1.3.0.tar.gz

504 Gateway Time-out

The server didn't respond in time.

```

This change stops ignoring the result of downloading the tarball, and should make it more apparent when downloading a tarball has failed.