Created
March 24, 2011 18:44
-
-
Save adamhjk/885603 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default[:scout][:user] = "scout" | |
default[:scout][:interval] = 1 | |
#default[:scout][:group] = "scout" | |
#default[:scout][:version] = '5.0.3' | |
#default[:scout][:scout_bin] = "/usr/bin/scout" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo -i $(type -p chef-solo) | |
[Thu, 24 Mar 2011 14:28:18 -0400] INFO: Setting the run_list to ["role[tm_testing]", "role[appserver]", "recipe[sudo]"] from JSON | |
[Thu, 24 Mar 2011 14:28:18 -0400] INFO: Starting Chef Run (Version 0.9.14) | |
[Thu, 24 Mar 2011 14:28:18 -0400] ERROR: Running exception handlers | |
[Thu, 24 Mar 2011 14:28:18 -0400] ERROR: Exception handlers complete | |
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/resource.rb:144:in `method_missing': undefined method `find_scout' for Chef::Resource::Cron (NoMethodError) | |
from /etc/chef/cookbooks/scout/recipes/default.rb:34:in `from_file' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/mixin/recipe_definition_dsl_core.rb:72:in `instance_eval' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/mixin/recipe_definition_dsl_core.rb:72:in `method_missing' | |
from /etc/chef/cookbooks/scout/recipes/default.rb:32:in `from_file' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/cookbook_version.rb:473:in `load_recipe' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/mixin/language_include_recipe.rb:40:in `include_recipe' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `each' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/run_context.rb:94:in `load' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/run_context.rb:91:in `each' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/run_context.rb:91:in `load' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/run_context.rb:55:in `initialize' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/client.rb:155:in `new' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/client.rb:155:in `run' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/application/solo.rb:190:in `run_application' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/application/solo.rb:181:in `loop' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/application/solo.rb:181:in `run_application' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/../lib/chef/application.rb:62:in `run' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/chef-0.9.14/bin/chef-solo:25 | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/bin/chef-solo:19:in `load' | |
from /usr/local/rvm/gems/ree-1.8.7-2011.03/bin/chef-solo:19 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find scout. Given rvm, and ubuntu's weird paths this is slightly tricky | |
# This does hardcode a search preference | |
class ChefScout | |
def self.find_scout | |
if File.exists?("/usr/local/bin/rvm") | |
return `rvm default exec which scout`.chomp | |
else | |
[ | |
"/usr/bin", | |
"/var/lib/gems/1.8/bin", | |
"/var/lib/gems/1.9/bin" | |
].each do |dir| | |
scout_bin = File.join(dir, "scout") | |
return scout_bin if File.exists?(scout_bin) | |
end | |
end | |
Chef::Log.error("You asked me to find scout, but I could not") | |
return "scout" | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if defined?(node[:scout][:key]) | |
# run scount once, right now. Just so we can start seeing data | |
# without waiting. | |
bash "initialize scout" do | |
user node[:scout][:user] | |
command "#{ChefScount.find_scout} #{node[:scout][:key]}" | |
not_if do File.exist?("/home/{#node[:scout][:user]}/.scout") end | |
end | |
cron "scout" do | |
user node[:scout][:user] | |
command "#{find_scout} #{node[:scout][:key]}" | |
minute "*/#{node[:scout][:interval]}" | |
end | |
else | |
Chef::Log.error "Must define [:scout][:key] for this node" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment