Skip to content

Instantly share code, notes, and snippets.

@tas50
Created February 28, 2013 21:37
Show Gist options
  • Save tas50/5060334 to your computer and use it in GitHub Desktop.
Save tas50/5060334 to your computer and use it in GitHub Desktop.
Ruby 1.9.1 breaking Collectd cookbook
[2013-02-28T20:09:46+00:00] INFO: Processing ruby_block[delete_old_plugins] action create (collectd::default line 74)
================================================================================
Error executing action `create` on resource 'ruby_block[delete_old_plugins]'
================================================================================
NoMethodError
-------------
private method `open' called for Chef::Resource::File:Class
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/collectd/recipes/default.rb:78:in `block (3 levels) in from_file'
/var/chef/cache/cookbooks/collectd/recipes/default.rb:76:in `each'
/var/chef/cache/cookbooks/collectd/recipes/default.rb:76:in `block (2 levels) in from_file'
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/collectd/recipes/default.rb
74: ruby_block "delete_old_plugins" do
75: block do
76: Dir['/etc/collectd/plugins/*.conf'].each do |path|
77: autogen = false
78: File.open(path).each_line do |line|
79: if line.start_with?('#') and line.include?('autogenerated')
80: autogen = true
81: break
82: end
83: end
84: if autogen
85: begin
86: resources(:template => path)
87: rescue Chef::Exceptions::ResourceNotFound
88: # If the file is autogenerated and has no template it has likely been removed from the run list
89: Chef::Log.info("Deleting old plugin config in #{path}")
90: File.unlink(path)
91: end
92: end
93: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/collectd/recipes/default.rb:74:in `from_file'
ruby_block("delete_old_plugins") do
action "create"
retries 0
retry_delay 2
block_name "delete_old_plugins"
cookbook_name "collectd"
recipe_name "default"
block #<Proc:0x0000000424f460@/var/chef/cache/cookbooks/collectd/recipes/default.rb:75>
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment