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

Dependency is missing #122

Closed spuder closed 9 years ago

spuder commented 9 years ago

If you run vagrant up, then you will get a stacktrace from chef

==> default: stdin: is not a tty
==> default: [2015-01-20T00:00:38+00:00] INFO: Forking chef instance to converge...
==> default: [2015-01-20T00:00:38+00:00] INFO: *** Chef 12.0.3 ***
==> default: [2015-01-20T00:00:38+00:00] INFO: Chef-client pid: 1396
==> default: [2015-01-20T00:00:39+00:00] INFO: Setting the run_list to ["recipe[zookeeper::default]"] from CLI options
==> default: [2015-01-20T00:00:39+00:00] INFO: Run List is [recipe[zookeeper::default]]
==> default: [2015-01-20T00:00:39+00:00] INFO: Run List expands to [zookeeper::default]
==> default: [2015-01-20T00:00:39+00:00] INFO: Starting Chef Run for zookeeper
==> default: [2015-01-20T00:00:39+00:00] INFO: Running start handlers
==> default: [2015-01-20T00:00:39+00:00] INFO: Start handlers complete.
==> default: [2015-01-20T00:00:39+00:00] ERROR: Running exception handlers
==> default: [2015-01-20T00:00:39+00:00] ERROR: Exception handlers complete
==> default: [2015-01-20T00:00:39+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2015-01-20T00:00:39+00:00] ERROR: Cookbook zookeeper not found. If you're loading zookeeper from another cookbook, make sure you configure the dependency in your metadata
==> default: [2015-01-20T00:00:39+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

If you look at the stack trace, it shows a missing dependency

vagrant@zookeeper:/var/chef/cache$ cat chef-stacktrace.out
cat: chef-stacktrace.out: Permission denied
vagrant@zookeeper:/var/chef/cache$ sudo !!
sudo cat chef-stacktrace.out
Generated at 2015-01-20 00:00:39 +0000
Chef::Exceptions::CookbookNotFound: Cookbook zookeeper not found. If you're loading zookeeper from another cookbook, make sure you configure the dependency in your metadata
/opt/chef/embedded/apps/chef/lib/chef/cookbook/cookbook_collection.rb:38:in `block in initialize'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/ohai-8.0.1/lib/ohai/mash.rb:77:in `yield'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/ohai-8.0.1/lib/ohai/mash.rb:77:in `default'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/ohai-8.0.1/lib/ohai/mash.rb:77:in `default'
/opt/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:277:in `[]'
/opt/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:277:in `each_cookbook_dep'
/opt/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:255:in `add_cookbook_with_deps'
/opt/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:88:in `block in cookbook_order'
/opt/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:86:in `each'
/opt/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:86:in `cookbook_order'
/opt/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:98:in `compile_libraries'
/opt/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:71:in `compile'
/opt/chef/embedded/apps/chef/lib/chef/run_context.rb:92:in `load'
/opt/chef/embedded/apps/chef/lib/chef/policy_builder/expand_node_object.rb:73:in `setup_run_context'
/opt/chef/embedded/apps/chef/lib/chef/client.rb:235:in `setup_run_context'
/opt/chef/embedded/apps/chef/lib/chef/client.rb:397:in `run'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:261:in `block in fork_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:249:in `fork'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:249:in `fork_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:215:in `block in run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/local_mode.rb:38:in `with_server_connectivity'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:201:in `run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application/solo.rb:245:in `block in interval_run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application/solo.rb:234:in `loop'
/opt/chef/embedded/apps/chef/lib/chef/application/solo.rb:234:in `interval_run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application/solo.rb:224:in `run_application'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:58:in `run'
/opt/chef/embedded/apps/chef/bin/chef-solo:25:in `<top (required)>'
/usr/bin/chef-solo:40:in `load'
/usr/bin/chef-solo:40:in `<main>'vagrant@zookeeper:/var/chef/cache$ ls
chef-client-running.pid  chef-stacktrace.out

I'm guessing this is a simple fix, but I am new to chef.

jeffbyrnes commented 9 years ago

I'll let @jakedavis speak up regarding using Vagrant on its own for testing this cookbook, but my encouragement would be to use Test Kitchen to test cookbooks.

This cookbook is really meant to be wrapped by a cookbook specific to your own needs, and that pattern is most easily followed by using Berkshelf (which this cookbook is set up to use).

I'd encourage installing the Chef DK to get all set up with Chef, Test Kitchen, Berkshelf, and a few other goodies to more easily test. You’ll still need Vagrant & VirtualBox/VMWare for local VMs, but it will drastically simplify things.

As an example, your wrapper cookbook would, at the very least, have a metadata.rb something like this:

name             'your_zookeeper'
maintainer       'You'
maintainer_email 'you@evertrue.com'
license          'All rights reserved'
description      'Installs/Configures zookeeper'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version          '1.0.0'

depends 'zookeeper',       '~> 2.5'

And a recipes/default.rb like this:

#
# Cookbook Name:: your_zookeeper
# Recipe:: default
#
# Copyright (C) 2015 You
#
# All rights reserved - Do Not Redistribute
#

include_recipe 'zookeeper::default'

You can also override attributes & other things, or even take advantage of the separate recipes available in this cookbook, or even utilize the resources this cookbook provides directly.

jakedavis commented 9 years ago

+1 on TK and probably +1 on deprecating Vagrant.

solarce commented 9 years ago

fwiw, I have a sample wrapper up at https://github.com/solarce/zk-wrapper

spuder commented 9 years ago

Thanks, I am using test kitchen now.

Just realized that this cookbook comes from simple.com. I've been telling everyone about how awesome that bank is.