reliantsecurity/hiera-redis — pull request #1 by timurbatyrshin (2012-06-26 16:05:03+00:00)
Title: Fix hiera crashing if there is no :redis: section present in hiera.yaml

If we have no :redis: section in hiera.yaml (e.g. we are using the default settings) we receive a crash while accessing hiera-redis backend:

# hiera foo
/var/lib/gems/1.8/gems/hiera-redis-0.2.1/lib/hiera/backend/redis_backend.rb:20:in `initialize': undefined method `has_key?' for nil:NilClass (NoMethodError)
from /var/lib/gems/1.8/gems/hiera-redis-0.2.1/lib/hiera/backend/redis_backend.rb:18:in `each_key'
from /var/lib/gems/1.8/gems/hiera-redis-0.2.1/lib/hiera/backend/redis_backend.rb:18:in `initialize'
from /var/lib/gems/1.8/gems/hiera-0.3.0.25/lib/hiera/backend.rb:168:in `new'
from /var/lib/gems/1.8/gems/hiera-0.3.0.25/lib/hiera/backend.rb:168:in `lookup'
from /var/lib/gems/1.8/gems/hiera-0.3.0.25/lib/hiera/backend.rb:166:in `each'
from /var/lib/gems/1.8/gems/hiera-0.3.0.25/lib/hiera/backend.rb:166:in `lookup'
from /var/lib/gems/1.8/gems/hiera-0.3.0.25/lib/hiera.rb:65:in `lookup'
from /usr/local/bin/hiera:211

This commit fixes that (however does not produce any warnings as I'm not sure they are needed).