hw-cookbooks/postgresql — pull request #139 by mlafeldt (2014-04-30 15:40:46+00:00)
Title: Avoid stale Debian package index

By running `apt-get update` when the `update-success-stamp` file exists, but is older than 1 day.

Bug description:

If `/var/lib/apt/periodic/update-success-stamp` already exists after booting, the ruby recipe won't run `apt-get update` before installing the pg gem. This gem has native extensions and wants to install packages before `apt::default` can be executed. As a result, the package index is out of date and the Chef run fails.

The issue is described in more detail here: https://github.com/elm-city-craftworks/practicing-ruby-cookbook/issues/24

The fix basically mimics the behavior of the [apt cookbook](https://github.com/opscode-cookbooks/apt/blob/bb1849257902070fd8f418b8bd349ae98bcbaf8e/recipes/default.rb#L70).