evertrue / zookeeper-cookbook

Chef cookbook for installing and managing Zookeeper.
https://supermarket.chef.io/cookbooks/zookeeper
Apache License 2.0
81 stars 117 forks source link

Install fails with default values #141

Closed ianbamforth closed 9 years ago

ianbamforth commented 9 years ago

I wanted to use this cookbook to just install the zookeeper libraries, so just added "recipe[zookeeper::install]". Attempting to cook a server I get the following error:

NoMethodError


undefined method `map' for false:FalseClass

Cookbook Trace:


/home/me/chef-solo/cookbooks-2/magic/libraries/configuration.rb:70:in `exports_config'
/home/me/chef-solo/cookbooks-2/zookeeper/recipes/install.rb:46:in `block in from_file'
/home/me/chef-solo/cookbooks-2/zookeeper/recipes/install.rb:44:in `from_file'
/home/me/chef-solo/cookbooks-2/zookeeper/recipes/default.rb:18:in `from_file'

Relevant File Content:


/home/me/chef-solo/cookbooks-2/magic/libraries/configuration.rb:

63: def exports_raw_config obj 64: obj.map do |k, v| 65: "export #{k}=#{Shellwords.escape v.to_s}" 66: end.join("\n") 67: end 68: 69: def exports_config obj 70>> obj.map do |k, v| 71: "export #{k}=#{Shellwords.escape v.to_s}" 72: end.join("\n") 73: end 74: 75: def ini_config obj 76: obj.map do |name, config| 77: "[#{name}]\n" + \ 78: config.map do |k, v| 79: "#{k}=#{v}"

The only place exports_config is used in the zookeeper config is in install.rb:

# Add optional Zookeeper environment vars
file "#{node[:zookeeper][:config_dir]}/zookeeper-env.sh" do
  owner node[:zookeeper][:user]
  content exports_config node[:zookeeper][:env_vars]
  only_if { node[:zookeeper][:env_vars] }
end

And node[:zookeeper][:env_vars] defaults to false. I am not setting it anywhere else.

Any idea what's going on here?

jeffbyrnes commented 9 years ago

@ianbamforth damn, that might be my fault. I wrote that feature pretty quickly. I’ll check it out.

jeffbyrnes commented 9 years ago

Yeah, I neglected to test with the default attributes settings, just tested setting the attributes in .kitchen.yml. I’ll test with the default settings, and rectify what is clearly a bug you’ve found.

jeffbyrnes commented 9 years ago

Fixed, shipped in v2.11.0

ianbamforth commented 9 years ago

Thanks for the swift response! On 13 Aug 2015 22:08, Jeff Byrnes notifications@github.com wrote:Fixed, shipped in v2.11.0

—Reply to this email directly or view it on GitHub.