Possible fix for yum lock timeout issues on Amazon Linux.

Various cookbooks that utilize yum packages on Amazon Linux can randomly fail to get a lock on yum, and so fail. A simple solution I've found and implemented is to simply add 'retries 5' and 'retry_delay 10' to the cookbook to give yum a chance to free up the lock.

Here's an example of the errors you get otherwise:



ec2-107-21-165-91.compute-1.amazonaws.com [2012-12-11T21:45:52+00:00] INFO: Processing package[vim] action install (vim::default line 30)
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com ================================================================================
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com Error executing action `install` on resource 'package[vim]'
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com ================================================================================
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com Chef::Exceptions::Package
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com -------------------------
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com Yum failed - #<Process::Status: pid 2072 exit 200> - returns: ["yum-dump Locking Error! Couldn't obtain an exclusive yum lock in 10 seconds. Giving up.\n"]
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com Resource Declaration:
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com ---------------------
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com # In /var/chef/cache/cookbooks/vim/recipes/default.rb
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com  30:   package vim_base_pkg
ec2-107-21-165-91.compute-1.amazonaws.com  31: end
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com Compiled Resource:
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com ------------------
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com # Declared in /var/chef/cache/cookbooks/vim/recipes/default.rb:30:in `block in from_file'
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com package("vim") do
ec2-107-21-165-91.compute-1.amazonaws.com   action :install
ec2-107-21-165-91.compute-1.amazonaws.com   retries 0
ec2-107-21-165-91.compute-1.amazonaws.com   retry_delay 2
ec2-107-21-165-91.compute-1.amazonaws.com   package_name "vim"
ec2-107-21-165-91.compute-1.amazonaws.com   cookbook_name "vim"
ec2-107-21-165-91.compute-1.amazonaws.com   recipe_name "default"
ec2-107-21-165-91.compute-1.amazonaws.com end
ec2-107-21-165-91.compute-1.amazonaws.com 
ec2-107-21-165-91.compute-1.amazonaws.com [2012-12-11T21:46:08+00:00] ERROR: Running exception handlers
ec2-107-21-165-91.compute-1.amazonaws.com [2012-12-11T21:46:09+00:00] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
ec2-107-21-165-91.compute-1.amazonaws.com [2012-12-11T21:46:09+00:00] ERROR: Exception handlers complete
ec2-107-21-165-91.compute-1.amazonaws.com [2012-12-11T21:46:10+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
ec2-107-21-165-91.compute-1.amazonaws.com [2012-12-11T21:46:10+00:00] FATAL: Chef::Exceptions::Package: package[vim] (vim::default line 30) had an error: Chef::Exceptions::Package: Yum failed - #<Process::Status: pid 2072 exit 200> - returns: ["yum-dump Locking Error! Couldn't obtain an exclusive yum lock in 10 seconds. Giving up.\n"]