elijah / chef-prometheus

Chef cookbook for Prometheus. The open source service monitoring system and time-series database.
Apache License 2.0
52 stars 93 forks source link

Property filter of accumulator[/opt/prometheus/prometheus.yml] cannot be passed a block! #66

Closed lanerjo closed 7 years ago

lanerjo commented 7 years ago

While attempting to run chef-client on the default prometheus recipe - Ubuntu 16.04 I am getting the following error. Any help would be greatly appreciated.

================================================================================ Recipe Compile Error in /var/chef/cache/cookbooks/prometheus/recipes/default.rb

RuntimeError

Property filter of accumulator[/opt/prometheus/prometheus.yml] cannot be passed a block! If you meant to create a resource named filter instead, you'll need to first rename the property.

Cookbook Trace:

/var/chef/cache/cookbooks/prometheus/recipes/default.rb:70:in block in from_file' /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_builder.rb:90:ininstance_eval' /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_builder.rb:90:in build' /var/chef/cache/cookbooks/prometheus/recipes/default.rb:69:infrom_file'

Relevant File Content:

/var/chef/cache/cookbooks/prometheus/recipes/default.rb:

63: prometheus_job 'prometheus' do 64: scrape_interval '15s' 65: target "localhost#{node['prometheus']['flags']['web.listen-address']}" 66: metrics_path node['prometheus']['flags']['web.telemetry-path'] 67: end 68:
69: accumulator node['prometheus']['flags']['config.file'] do 70>> filter { |res| res.is_a? Chef::Resource::PrometheusJob } 71: target template: node['prometheus']['flags']['config.file'] 72: transform { |jobs| jobs.sort_by(&:name) } 73: variable_name :jobs 74: notifies :restart, 'service[prometheus]' 75:
76: not_if { node['prometheus']['allow_external_config'] && File.exist?(node['prometheus']['flags']['config.file']) } 77: end 78:
79: # -- Do the install -- #

Running handlers: [2017-01-24T15:07:15-07:00] ERROR: Running exception handlers Running handlers complete [2017-01-24T15:07:15-07:00] ERROR: Exception handlers complete Chef Client failed. 0 resources updated in 04 seconds [2017-01-24T15:07:15-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out [2017-01-24T15:07:15-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report [2017-01-24T15:07:15-07:00] ERROR: Property filter of accumulator[/opt/prometheus/prometheus.yml] cannot be passed a block! If you meant to create a resource named filter instead, you'll need to first rename the property. [2017-01-24T15:07:15-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

GNU nano 2.5.3 File: /var/chef/cache/chef-stacktrace.out

Generated at 2017-01-24 15:07:15 -0700 RuntimeError: Property filter of accumulator[/opt/prometheus/prometheus.yml] cannot be passed a block! If you meant to crea$ /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/property.rb:510:in filter' /var/chef/cache/cookbooks/prometheus/recipes/default.rb:70:inblock in from_file' /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_builder.rb:90:in instance_eval' /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_builder.rb:90:inbuild' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/dsl/declare_resource.rb:104:in build_resource' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/dsl/declare_resource.rb:62:indeclare_resource' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/dsl/resources.rb:40:in accumulator' /var/chef/cache/cookbooks/prometheus/recipes/default.rb:69:infrom_file' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/mixin/from_file.rb:30:in instance_eval' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/mixin/from_file.rb:30:infrom_file' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/cookbook_version.rb:229:in load_recipe' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context.rb:332:inload_recipe' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbookcompiler.rb:140:in `block in compile$ /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:138:in each' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:138:incompile_recipes' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:75:in compile' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context.rb:167:inload' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/policy_builder/expand_node_object.rb:93:in setup_run_cont$ /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/client.rb:509:insetup_run_context' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/client.rb:277:in run' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:270:inblock in fork_chef_client' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:258:in fork' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:258:infork_chef_client' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:223:in block in run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/local_mode.rb:44:inwith_server_connectivity' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:211:in run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/client.rb:433:inblock in interval_run_chef_c$ /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/client.rb:423:in loop' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/client.rb:423:ininterval_run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/client.rb:412:in run_application' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:58:inrun' /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/bin/chef-client:26:in <top (required)>' /usr/bin/chef-client:50:inload' /usr/bin/chef-client:50:in `

'

elijah commented 7 years ago

This is probably dead now due to the accumulator patch from thommay that i just merged. please try it again?