Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

undefined method `new' for Zookeeper:Module #93

Closed
yourabi opened this issue Aug 2, 2014 · 10 comments · Fixed by #116
Closed

undefined method `new' for Zookeeper:Module #93

yourabi opened this issue Aug 2, 2014 · 10 comments · Fixed by #116

Comments

@yourabi
Copy link

yourabi commented Aug 2, 2014

Hi -

No matter how I try to use the chef-zookeeper cookbook I get the following 'undefined method'... Could someone point out what I'm doing wrong? Thanks!

I have a wrapper cookbook (cl-zookeeper) and it depends on 'java' and 'chef-zookeeper' cookbooks.

cl-zookeeper::default.rb looks like this

node.default[:java][:install_flavor] = "openjdk"                                                                                                                                                                                                                              
node.default[:java][:jdk_version] = "7"                                                                                                                                                                                                                                       
node.default[:java][:set_default] = true                                                                                                                                                                                                                                      


node.default[:zookeeper][:version]     = '3.4.6'                                                                                                                                                                                                                              
node.default[:zookeeper][:checksum]    = '01b3938547cd620dc4c93efe07c0360411f4a66962a70500b163b59014046994'                                                                                                                                                                   
node.default[:zookeeper][:mirror]      = 'http://apache.cs.utah.edu/zookeeper'                                                                                                                                                                                                
node.default[:zookeeper][:user]        = 'zookeeper'                                                                                                                                                                                                                          
node.default[:zookeeper][:install_dir] = '/opt/zookeeper'      

zookeeper '3.4.6' do                                                                                                                                                                                                                                                          
  user 'zookeeper'                                                                                                                                                                                                                                                            
  mirror 'http://apache.cs.utah.edu/zookeeper/'                                                                                                                                                                                                                               
  # Undocumented but this is the sha256 checksum...                                                                                                                                                                                                                           
  checksum '01b3938547cd620dc4c93efe07c0360411f4a66962a70500b163b59014046994'                                                                                                                                                                                                 
  action :install                                                                                                                                                                                                                                                             
end                     
NoMethodError
-------------
undefined method `new' for Zookeeper:Module


Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/chef-zookeeper/recipes/default.rb:22:in `from_file'
  /var/chef/cache/cookbooks/cl-zookeeper/recipes/default.rb:20:in `from_file'


Relevant File Content:
----------------------
/var/chef/cache/cookbooks/chef-zookeeper/recipes/default.rb:

 15:  # limitations under the License.
 16:  
 17:  node.override['build-essential']['compile_time'] = true
 18:  
 19:  include_recipe 'build-essential::default'
 20:  include_recipe 'java::default'
 21:  
 22>> zookeeper node[:zookeeper][:version] do
 23:    user        node[:zookeeper][:user]
 24:    mirror      node[:zookeeper][:mirror]
 25:    checksum    node[:zookeeper][:checksum]
 26:    install_dir node[:zookeeper][:install_dir]
 27:    action      :install
 28:  end
 29:  
 30:  config_path = ::File.join(node[:zookeeper][:install_dir],
 31:                            "zookeeper-#{node[:zookeeper][:version]}",
@yourabi
Copy link
Author

yourabi commented Aug 2, 2014

Closing - my bad.

Referenced incorrect cookbook name in metadata.rb

@yourabi yourabi closed this as completed Aug 2, 2014
@jakedavis
Copy link
Contributor

Glad you figured it out! Let us know if we can help in any way; we're using this internally but there could easily be bugs all over. Thanks!

@crax
Copy link

crax commented Dec 9, 2014

I have met the same error: undefined method `new' for Zookeeper:Module, when using it in chef solo json file: "run_list": ["recipe[zookeeper]"].

Could you tell where i am wrong? Thank you.

@urog
Copy link

urog commented Dec 9, 2014

@crax I had this problem using chef 12. Use version 11.8.2 (like in the .kitchem.yml file in the cookbook) and you should be fine.

@eherot
Copy link
Contributor

eherot commented Dec 9, 2014

I too ran into this error. "Fixed" by using Chef < 12. 11.16.4 seemed to work fine.

@jakedavis
Copy link
Contributor

Oh weird. Let's reopen and dig. I am going to devote some time today to running through a bunch of PRs so hopefully can figure this one out ... thanks for reporting, all.

@jakedavis jakedavis reopened this Dec 9, 2014
@eherot
Copy link
Contributor

eherot commented Dec 9, 2014

I'm not sure these are related. I ran into this problem when doing something that should have required no entries in metadata.rb (I had added it to a test kitchen run list).

@chkelly
Copy link
Contributor

chkelly commented Dec 10, 2014

So if it helps, this is most likely because you are using chef 12. In my case, I was running the latest chef 11 in our environments and locally, but i was missing a line in our .kitchen.yml file that ensures that when kitchen.ci provisions the instance, it will use the appropriate chef version.

For example:

provisioner:
name: chef_zero
require_chef_omnibus: 11.16.4-1

Will ensure that any provisioned vagrant VMs use chef 11.16.4-1 and not chef 12 (the latest).

This does mean that this cookbook is incompatible with chef 12, something that should be looked into though.

@eherot
Copy link
Contributor

eherot commented Dec 10, 2014

@chkelly I assume this doesn't mean that you're saying it's a bug in Chef 12, right?

@mikesplain
Copy link
Contributor

@eherot @chkelly This looks like a chef-client error. Others are seeing it too: chef/chef#2575

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants