Skip to content

Instantly share code, notes, and snippets.

@pcn
Created June 1, 2012 05:43
Show Gist options
  • Save pcn/2849211 to your computer and use it in GitHub Desktop.
Save pcn/2849211 to your computer and use it in GitHub Desktop.
Trying to use shell_out in a chef recipe
sudo chef-solo -l debug -c solo.rb -j node-cassandra.json -L /var/log/chef/solo.log -r /tmp/Systems-0.0.2.tar.gz
# Logfile created on 2012-06-01 05:40:22 +0000 by logger.rb/25413
[Fri, 01 Jun 2012 05:40:22 +0000] DEBUG: Creating path /var/tmp to extract recipes into
[Fri, 01 Jun 2012 05:40:22 +0000] DEBUG: Executing tar zxvfC /var/tmp/recipes.tgz /var/tmp
[Fri, 01 Jun 2012 05:40:22 +0000] DEBUG: ---- Begin output of tar zxvfC /var/tmp/recipes.tgz /var/tmp ----
[Fri, 01 Jun 2012 05:40:22 +0000] DEBUG: STDOUT: cookbooks/
cookbooks/apt/
cookbooks/bib/
cookbooks/cassandra/
cookbooks/diamond/
cookbooks/java/
cookbooks/logstash/
cookbooks/platform_config/
cookbooks/runit/
cookbooks/runit/attributes/
cookbooks/runit/CHANGELOG.md
cookbooks/runit/CONTRIBUTING
cookbooks/runit/definitions/
cookbooks/runit/files/
cookbooks/runit/LICENSE
cookbooks/runit/metadata.rb
cookbooks/runit/README.md
cookbooks/runit/recipes/
cookbooks/runit/templates/
cookbooks/runit/templates/gentoo/
cookbooks/runit/templates/gentoo/runit-start.sh.erb
cookbooks/runit/recipes/default.rb
cookbooks/runit/files/default/
cookbooks/runit/files/ubuntu-6.10/
cookbooks/runit/files/ubuntu-7.04/
cookbooks/runit/files/ubuntu-7.10/
cookbooks/runit/files/ubuntu-8.04/
cookbooks/runit/files/ubuntu-8.04/runsvdir
cookbooks/runit/files/ubuntu-7.10/runsvdir
cookbooks/runit/files/ubuntu-7.04/runsvdir
cookbooks/runit/files/ubuntu-6.10/runsvdir
cookbooks/runit/files/default/runit.seed
cookbooks/runit/files/default/runsvdir
cookbooks/runit/definitions/runit_service.rb
cookbooks/runit/attributes/default.rb
cookbooks/platform_config/attributes/
cookbooks/platform_config/definitions/
cookbooks/platform_config/files/
cookbooks/platform_config/libraries/
cookbooks/platform_config/metadata.rb
cookbooks/platform_config/providers/
cookbooks/platform_config/README.md
cookbooks/platform_config/recipes/
cookbooks/platform_config/resources/
cookbooks/platform_config/templates/
cookbooks/platform_config/templates/default/
cookbooks/platform_config/resources/default.rb
cookbooks/platform_config/recipes/default.rb
cookbooks/platform_config/files/default/
cookbooks/platform_config/attributes/default.rb
cookbooks/logstash/attributes/
cookbooks/logstash/files/
cookbooks/logstash/LICENSE
cookbooks/logstash/metadata.rb
cookbooks/logstash/README.md
cookbooks/logstash/recipes/
cookbooks/logstash/templates/
cookbooks/logstash/templates/default/
cookbooks/logstash/templates/default/agent.conf.erb
cookbooks/logstash/templates/default/knewton-logstash-agent.conf.erb
cookbooks/logstash/templates/default/logstash-agent.init.erb
cookbooks/logstash/templates/default/logstash-web.init.erb
cookbooks/logstash/templates/default/sv-logstash-agent-log-run.erb
cookbooks/logstash/templates/default/sv-logstash-agent-run.erb
cookbooks/logstash/templates/default/sv-logstash-web-log-run.erb
cookbooks/logstash/templates/default/sv-logstash-web-run.erb
cookbooks/logstash/recipes/default.rb
cookbooks/logstash/recipes/grok.rb
cookbooks/logstash/files/default/
cookbooks/logstash/files/default/opt_knewton_logstash_grok.tar.gz
cookbooks/logstash/attributes/default.rb
cookbooks/java/attributes/
cookbooks/java/CHANGELOG.md
cookbooks/java/CONTRIBUTING
cookbooks/java/LICENSE
cookbooks/java/metadata.rb
cookbooks/java/providers/
cookbooks/java/README.md
cookbooks/java/recipes/
cookbooks/java/resources/
cookbooks/java/resources/ark.rb
cookbooks/java/recipes/default.rb
cookbooks/java/recipes/openjdk.rb
cookbooks/java/recipes/oracle.rb
cookbooks/java/recipes/oracle_i386.rb
cookbooks/java/providers/ark.rb
cookbooks/java/attributes/default.rb
cookbooks/diamond/attributes/
cookbooks/diamond/definitions/
cookbooks/diamond/files/
cookbooks/diamond/libraries/
cookbooks/diamond/metadata.rb
cookbooks/diamond/providers/
cookbooks/diamond/README.md
cookbooks/diamond/recipes/
cookbooks/diamond/resources/
cookbooks/diamond/templates/
cookbooks/diamond/templates/default/
cookbooks/diamond/templates/default/diamond.conf.erb
cookbooks/diamond/recipes/default.rb
cookbooks/diamond/files/default/
cookbooks/diamond/attributes/default.rb
cookbooks/cassandra/attributes/
cookbooks/cassandra/files/
cookbooks/cassandra/metadata.rb
cookbooks/cassandra/README.md
cookbooks/cassandra/recipes/
cookbooks/cassandra/templates/
cookbooks/cassandra/templates/default/
cookbooks/cassandra/templates/default/access.properties.erb
cookbooks/cassandra/templates/default/cassandra.yaml.erb
cookbooks/cassandra/templates/default/cassandra_db_seeds.rb.erb
cookbooks/cassandra/templates/default/cassandra_tools.sh.erb
cookbooks/cassandra/templates/default/iptables.erb
cookbooks/cassandra/templates/default/log4j-server.properties.erb
cookbooks/cassandra/templates/default/passwd.properties.erb
cookbooks/cassandra/templates/default/rack.properties.erb
cookbooks/cassandra/templates/default/sv-cassandra-log-run.erb
cookbooks/cassandra/templates/default/sv-cassandra-run.erb
cookbooks/cassandra/recipes/authentication.rb
cookbooks/cassandra/recipes/autoconf.rb
cookbooks/cassandra/recipes/bintools.rb
cookbooks/cassandra/recipes/client.rb
cookbooks/cassandra/recipes/datastax_install_from_package.rb
cookbooks/cassandra/recipes/default.rb
cookbooks/cassandra/recipes/ec2snitch.rb
cookbooks/cassandra/recipes/install_from_git.rb
cookbooks/cassandra/recipes/install_from_package.rb
cookbooks/cassandra/recipes/install_from_release.rb
cookbooks/cassandra/recipes/iptables.rb
cookbooks/cassandra/recipes/jna_support.rb
cookbooks/cassandra/recipes/mx4j.rb
cookbooks/cassandra/recipes/ruby_client.rb
cookbooks/cassandra/recipes/server.rb
cookbooks/cassandra/recipes/zk_autoconf.rb
cookbooks/cassandra/recipes/zk_install_from_pacakge.rb
cookbooks/cassandra/recipes/zk_server.rb
cookbooks/cassandra/files/default/
cookbooks/cassandra/files/default/zk_first_or_wait.py
cookbooks/cassandra/files/default/zk_mark_as_done.py
cookbooks/cassandra/attributes/default.rb
cookbooks/bib/libraries/
cookbooks/bib/metadata.rb
cookbooks/bib/README.md
cookbooks/bib/recipes/
cookbooks/bib/recipes/default.rb
cookbooks/bib/libraries/bibdiscovery.rb
cookbooks/bib/libraries/mem_calc.rb
cookbooks/apt/.git/
cookbooks/apt/files/
cookbooks/apt/metadata.rb
cookbooks/apt/providers/
cookbooks/apt/README.md
cookbooks/apt/recipes/
cookbooks/apt/resources/
cookbooks/apt/resources/repository.rb
cookbooks/apt/recipes/cacher-client.rb
cookbooks/apt/recipes/cacher.rb
cookbooks/apt/recipes/default.rb
cookbooks/apt/providers/repository.rb
cookbooks/apt/files/default/
cookbooks/apt/files/default/apt-cacher
cookbooks/apt/files/default/apt-cacher.conf
cookbooks/apt/files/default/apt-proxy-v2.conf
cookbooks/apt/.git/branches/
cookbooks/apt/.git/config
cookbooks/apt/.git/description
cookbooks/apt/.git/FETCH_HEAD
cookbooks/apt/.git/HEAD
cookbooks/apt/.git/hooks/
cookbooks/apt/.git/index
cookbooks/apt/.git/info/
cookbooks/apt/.git/logs/
cookbooks/apt/.git/objects/
cookbooks/apt/.git/ORIG_HEAD
cookbooks/apt/.git/packed-refs
cookbooks/apt/.git/refs/
cookbooks/apt/.git/refs/heads/
cookbooks/apt/.git/refs/remotes/
cookbooks/apt/.git/refs/tags/
cookbooks/apt/.git/refs/remotes/origin/
cookbooks/apt/.git/refs/remotes/origin/HEAD
cookbooks/apt/.git/refs/heads/master
cookbooks/apt/.git/objects/info/
cookbooks/apt/.git/objects/pack/
cookbooks/apt/.git/objects/pack/pack-e7b4e97c6c02664563f17d0513f0f872440690f5.idx
cookbooks/apt/.git/objects/pack/pack-e7b4e97c6c02664563f17d0513f0f872440690f5.pack
cookbooks/apt/.git/logs/HEAD
cookbooks/apt/.git/logs/refs/
cookbooks/apt/.git/logs/refs/heads/
cookbooks/apt/.git/logs/refs/heads/master
cookbooks/apt/.git/info/exclude
cookbooks/apt/.git/hooks/applypatch-msg.sample
cookbooks/apt/.git/hooks/commit-msg.sample
cookbooks/apt/.git/hooks/post-commit.sample
cookbooks/apt/.git/hooks/post-receive.sample
cookbooks/apt/.git/hooks/post-update.sample
cookbooks/apt/.git/hooks/pre-applypatch.sample
cookbooks/apt/.git/hooks/pre-commit.sample
cookbooks/apt/.git/hooks/pre-rebase.sample
cookbooks/apt/.git/hooks/prepare-commit-msg.sample
cookbooks/apt/.git/hooks/update.sample
systems_bundle.sh
solo.rb
node-base.json
node-cassandra.json
[Fri, 01 Jun 2012 05:40:22 +0000] DEBUG: STDERR:
[Fri, 01 Jun 2012 05:40:22 +0000] DEBUG: ---- End output of tar zxvfC /var/tmp/recipes.tgz /var/tmp ----
[Fri, 01 Jun 2012 05:40:22 +0000] DEBUG: Ran tar zxvfC /var/tmp/recipes.tgz /var/tmp returned 0
[Fri, 01 Jun 2012 05:40:22 +0000] INFO: *** Chef 0.10.8 ***
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Building node object for ip-10-125-107-109.ec2.internal
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Extracting run list from JSON attributes provided on command line
[Fri, 01 Jun 2012 05:40:23 +0000] INFO: Setting the run_list to ["recipe[java]", "recipe[cassandra]", "recipe[cassandra::datastax_install_from_package]", "recipe[cassandra::zk_server]"] from JSON
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Applying attributes from json file
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Platform is ubuntu version 11.04
[Fri, 01 Jun 2012 05:40:23 +0000] INFO: Run List is [recipe[java], recipe[cassandra], recipe[cassandra::datastax_install_from_package], recipe[cassandra::zk_server]]
[Fri, 01 Jun 2012 05:40:23 +0000] INFO: Run List expands to [java, cassandra, cassandra::datastax_install_from_package, cassandra::zk_server]
[Fri, 01 Jun 2012 05:40:23 +0000] INFO: Starting Chef Run for ip-10-125-107-109.ec2.internal
[Fri, 01 Jun 2012 05:40:23 +0000] INFO: Running start handlers
[Fri, 01 Jun 2012 05:40:23 +0000] INFO: Start handlers complete.
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: No chefignore file found at /var/tmp/cookbooks/chefignore no files will be ignored
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading cookbook bib's library file: /var/tmp/cookbooks/bib/libraries/mem_calc.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading cookbook bib's library file: /var/tmp/cookbooks/bib/libraries/bibdiscovery.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading cookbook apt's providers from /var/tmp/cookbooks/apt/providers/repository.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loaded contents of /var/tmp/cookbooks/apt/providers/repository.rb into a provider named apt_repository defined in Chef::Provider::AptRepository
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading cookbook java's providers from /var/tmp/cookbooks/java/providers/ark.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loaded contents of /var/tmp/cookbooks/java/providers/ark.rb into a provider named java_ark defined in Chef::Provider::JavaArk
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading cookbook apt's resources from /var/tmp/cookbooks/apt/resources/repository.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loaded contents of /var/tmp/cookbooks/apt/resources/repository.rb into a resource named apt_repository defined in Chef::Resource::AptRepository
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading cookbook java's resources from /var/tmp/cookbooks/java/resources/ark.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loaded contents of /var/tmp/cookbooks/java/resources/ark.rb into a resource named java_ark defined in Chef::Resource::JavaArk
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading cookbook platform_config's resources from /var/tmp/cookbooks/platform_config/resources/default.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loaded contents of /var/tmp/cookbooks/platform_config/resources/default.rb into a resource named platform_config defined in Chef::Resource::PlatformConfig
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Node ip-10-125-107-109.ec2.internal loading cookbook cassandra's attribute file /var/tmp/cookbooks/cassandra/attributes/default.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Node ip-10-125-107-109.ec2.internal loading cookbook diamond's attribute file /var/tmp/cookbooks/diamond/attributes/default.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Node ip-10-125-107-109.ec2.internal loading cookbook java's attribute file /var/tmp/cookbooks/java/attributes/default.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Node ip-10-125-107-109.ec2.internal loading cookbook logstash's attribute file /var/tmp/cookbooks/logstash/attributes/default.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Node ip-10-125-107-109.ec2.internal loading cookbook platform_config's attribute file /var/tmp/cookbooks/platform_config/attributes/default.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Node ip-10-125-107-109.ec2.internal loading cookbook runit's attribute file /var/tmp/cookbooks/runit/attributes/default.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading cookbook runit's definitions from /var/tmp/cookbooks/runit/definitions/runit_service.rb
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading Recipe java via include_recipe
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Found recipe default in cookbook java
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading Recipe java::oracle via include_recipe
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Found recipe oracle in cookbook java
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading Recipe cassandra via include_recipe
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Found recipe default in cookbook cassandra
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: I am not loading java, because I have already seen it.
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading Recipe cassandra::datastax_install_from_package via include_recipe
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Found recipe datastax_install_from_package in cookbook cassandra
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading Recipe apt via include_recipe
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Found recipe default in cookbook apt
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading Recipe cassandra::zk_server via include_recipe
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Found recipe zk_server in cookbook cassandra
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading Recipe runit via include_recipe
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Found recipe default in cookbook runit
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Loading Recipe bib via include_recipe
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Found recipe default in cookbook bib
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: I am not loading runit, because I have already seen it.
[Fri, 01 Jun 2012 05:40:23 +0000] ERROR: Running exception handlers
[Fri, 01 Jun 2012 05:40:23 +0000] ERROR: Exception handlers complete
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: Re-raising exception: NoMethodError - undefined method `shell_out' for #<Chef::Recipe:0x000000026043a0>
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/recipe_definition_dsl_core.rb:56:in `method_missing'
/var/tmp/cookbooks/cassandra/recipes/zk_server.rb:68:in `from_file'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/from_file.rb:30:in `instance_eval'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/from_file.rb:30:in `from_file'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/cookbook_version.rb:578:in `load_recipe'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/language_include_recipe.rb:40:in `block in include_recipe'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/language_include_recipe.rb:27:in `each'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/run_context.rb:72:in `block in load'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/run_context.rb:69:in `each'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/run_context.rb:69:in `load'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:195:in `setup_run_context'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:159:in `run'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:192:in `block in run_application'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `loop'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `run_application'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application.rb:67:in `run'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/bin/chef-solo:25:in `<top (required)>'
/usr/bin/chef-solo:23:in `load'
/usr/bin/chef-solo:23:in `<main>'
[Fri, 01 Jun 2012 05:40:23 +0000] FATAL: Stacktrace dumped to /var/tmp/chef-stacktrace.out
[Fri, 01 Jun 2012 05:40:23 +0000] DEBUG: NoMethodError: undefined method `shell_out' for #<Chef::Recipe:0x000000026043a0>
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/recipe_definition_dsl_core.rb:56:in `method_missing'
/var/tmp/cookbooks/cassandra/recipes/zk_server.rb:68:in `from_file'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/from_file.rb:30:in `instance_eval'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/from_file.rb:30:in `from_file'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/cookbook_version.rb:578:in `load_recipe'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/language_include_recipe.rb:40:in `block in include_recipe'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/language_include_recipe.rb:27:in `each'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/run_context.rb:72:in `block in load'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/run_context.rb:69:in `each'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/run_context.rb:69:in `load'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:195:in `setup_run_context'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:159:in `run'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:192:in `block in run_application'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `loop'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `run_application'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application.rb:67:in `run'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/bin/chef-solo:25:in `<top (required)>'
/usr/bin/chef-solo:23:in `load'
/usr/bin/chef-solo:23:in `<main>'
[Fri, 01 Jun 2012 05:40:23 +0000] FATAL: NoMethodError: undefined method `shell_out' for #<Chef::Recipe:0x000000026043a0>
#
# Cookbook Name:: cassandra
# Description:: Zookeeper discovery-based Server launch
# Recipe:: zk_server
# Author:: Benjamin Black (<b@b3k.us>)
# Author:: Modified by Peter Norton (<pn@knewton.com>)
#
# Copyright 2010, Flip Kromer
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include_recipe "runit"
include_recipe "bib"
min_heap = bib_total_mem_calc(node[:cassandra][:heap_min_pct], 256)
max_heap = bib_total_mem_calc(node[:cassandra][:heap_max_pct], 1024)
node[:cassandra][:java_heap_size_min] = "#{min_heap}M"
node[:cassandra][:java_heap_size_max] = "#{max_heap}M"
node[:cassandra][:concurrent_reads] = 2*node[:cpu][:total]
node[:cassandra][:concurrent_writes] = 32*node[:cpu][:total]
p = package "python-zookeeper" # Could install an old version (3.3.1), but
# should work for the simple case needed
# for this recipe
p.run_action(:install)
# Install the zc.zk library - assume that the zookeeper libraries are
# already installed.
p = execute "install_zc_zk" do
command "pip install zc.zk"
end
p.run_action(:run)
directory '/etc/sv/cassandra/env' do
owner 'root'
action :create
recursive true
end
runit_service "cassandra" do
options ({ :cassandra => node[:cassandra] })
run_state node[:cassandra][:run_state]
end
template "#{node[:cassandra][:conf_dir]}/log4j-server.properties" do
source "log4j-server.properties.erb"
owner "root"
group "root"
mode "0644"
variables :cassandra => node[:cassandra]
notifies :restart, "service[cassandra]"
end
cf = cookbook_file "/var/tmp/zk_first_or_wait.py" do
owner "root"
group "root"
mode "0755"
end
cf.run_action(:create)
cf = cookbook_file "/var/tmp/zk_mark_as_done.py" do
owner "root"
group "root"
mode "0755"
end
cf.run_action(:create)
# This will block when this system is not the seed
cmd = Chef::ShellOut.new("/var/tmp/zk_first_or_wait.py")
zk_state = cmd.run_command
seed = zk_state.stdout
p "seed is "
p seed
Chef::Log.info("Seed is: #{seed}")
# Racy. Proper fix involves proper orchestration.
template "#{node[:cassandra][:conf_dir]}/cassandra.yaml" do
source "cassandra.yaml.erb"
owner "root"
group "root"
mode "0644"
variables ( {
:seeds => [ seed ],
:cassandra => node[:cassandra],
} )
notifies :restart, "service[cassandra]", :delayed if startable?(node[:cassandra])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment