miah/chef-redis — pull request #60 by esigler (2014-02-12 20:03:08+00:00)
Title: Fix LWRP template reference, incorrect symlink path, and redis-extract-source default action

Howdy! I ran into a few issues while using this cookbook, let me know if you'd prefer these to be split out into three separate PR's:

1. When using the Redis LWRP from a wrapper cookbook, I ran into an invalid template reference
2. The default action on redis-extract-source causes bad behavior in some cases
3. The "symlink_binaries" path isn't correct for recent source builds

#### LWRP template references
I ran into this error while using the redis_instance LWRP:

Recipe: foobar::none
* group[redis] action create (up to date)
* user[redis] action create (up to date)
* directory[/var/log/redis (bazbat)] action create (up to date)
* directory[/etc/redis] action create (up to date)
* directory[/var/lib/redis] action create (up to date)
* directory[/var/run/redis] action create (up to date)
* template[/etc/init.d/redis-bazbat] action create
================================================================================
Error executing action `create` on resource 'template[/etc/init.d/redis-bazbat]'
================================================================================

Chef::Exceptions::FileNotFound
------------------------------
Cookbook 'foobar' (12.8.763) does not contain a file at any of these locations:
templates/ubuntu-10.04/redis_init.erb
templates/ubuntu/redis_init.erb
templates/default/redis_init.erb

Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/redis/providers/instance.rb

131: template "/etc/init.d/redis-#{new_resource.name}" do
132: source "redis_init.erb"
133: owner "root"
134: group "root"
135: mode 00755
136: variables new_resource.to_hash
137: end
138: when "runit"

I was using this as the LWRP reference:

include_recipe 'redis::default'
include_recipe 'redis::install'

redis_instance 'bazbat' do
action :create
end

This will provide an attribute that can be adjusted for those that need it, and a default for those that use this out of the box.

#### Default action on redis-extract-source
An incorrectly specified source_url caused a bad file to be created in the #{Chef::Config.file_cache_path}/#{redis_source_tarball} path. On the next run, the default "action :run" on redis-extract-source caused Chef to error out. Since there's already a trigger on remote_file, I switched the default action to avoid running into that again.

#### Symlink binary path incorrect
I also had a small issue where I set symlink_binaries to true, and the path was incorrectly linked. Fixed.