sous-chefs / logrotate

Development repository for the logrotate cookbook
https://supermarket.chef.io/cookbooks/logrotate
Apache License 2.0
122 stars 151 forks source link

undefined method `each' for nil:NilClass #129

Closed jacob-daniel-waller closed 5 years ago

jacob-daniel-waller commented 5 years ago

==> default: * template[/etc/logrotate.d/tomcat-myapp] action create ==> default: ==> default: ================================================================================ ==> default: Error executing action create on resource 'template[/etc/logrotate.d/tomcat-myapp]' ==> default: ================================================================================ ==> default: ==> default: Chef::Mixin::Template::TemplateError ==> default: ------------------------------------ ==> default: undefined method each' for nil:NilClass ==> default: ==> default: Resource Declaration: ==> default: --------------------- ==> default: # In /var/chef/cache/cookbooks/logrotate/definitions/logrotate_app.rb ==> default: ==> default: 28: template "/etc/logrotate.d/#{params[:name]}" do ==> default: 29: source params[:template] ==> default: 30: cookbook params[:cookbook] ==> default: 31: mode 0440 ==> default: 32: owner "root" ==> default: 33: group "root" ==> default: 34: backup false ==> default: 35: variables( ==> default: 36: :path => path, ==> default: 37: :create => create, ==> default: 38: :frequency => params[:frequency], ==> default: 39: :rotate => params[:rotate] ==> default: 40: ) ==> default: 41: end ==> default: 42: ==> default: ==> default: Compiled Resource: ==> default: ------------------ ==> default: # Declared in /var/chef/cache/cookbooks/logrotate/definitions/logrotate_app.rb:28:inblock in from_file' ==> default: ==> default: template("/etc/logrotate.d/tomcat-myapp") do ==> default: params {:enable=>true, :frequency=>"daily", :template=>"logrotate.erb", :cookbook=>"logrotate", :path=>"/var/log/tomcat/myapp.log", :options=>["missingok", "delaycompress", "notifempty"], :rotate=>30, :create=>"644 root adm", :name=>"tomcat-myapp"} ==> default: action [:create] ==> default: default_guard_interpreter :default ==> default: source "logrotate.erb" ==> default: declared_type :template ==> default: cookbook_name "combine_server" ==> default: recipe_name "log_rotate" ==> default: cookbook "logrotate" ==> default: mode 288 ==> default: owner "root" ==> default: group "root" ==> default: variables {:path=>["/var/log/tomcat/myapp.log"], :create=>"644 root adm", :frequency=>"daily", :rotate=>30} ==> default: path "/etc/logrotate.d/tomcat-myapp" ==> default: verifications [] ==> default: end ==> default: ==> default: Template Context: ==> default: ----------------- ==> default: on line #8 ==> default: 6: <%= @frequency %> ==> default: 7: <%- end %> ==> default: 8: <%- @configurables.each do |name, value| %> ==> default: 9: <%= "#{name} #{value}" %> ==> default: 10: <%- end %> ==> default: ==> default: System Info: ==> default: ------------ ==> default: chef_version=14.8.12 ==> default: platform=centos ==> default: platform_version=7.6.1810 ==> default: ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux] ==> default: program_name=/usr/bin/chef-solo ==> default: executable=/opt/chef/bin/chef-solo

jacob-daniel-waller commented 5 years ago

Closing this as it doesn't appear to be an issue for me now.

whatcould commented 5 years ago

I also had this issue! I think the cause was that somehow I had an old file hanging around at definitions/logrotate_app.rb, and logrotate_app was running that version instead of the version in resources/app.rb. Not sure how that happened but maybe this is helpful for anybody else who finds this.