Project

General

Profile

Bug #405

Foreman cannot process 2.6.2 reports

Added by Andrew Forgue over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Puppet Reports
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Our foreman install stopped processing reports after 2.6.2 upgrade.

Here's a stacktrace:

Failed to process report for host.domain.com due to:undefined method `>' for nil:NilClass -
    /var/www/apps/foreman/app/models/report.rb:175:in `metrics_to_hash'
        /var/www/apps/foreman/app/models/report.rb:87:in `import'
        /var/www/apps/foreman/app/controllers/reports_controller.rb:33:in `create'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:135:in `call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:135:in `custom'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:179:in `call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:179:in `respond'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:173:in `each'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:173:in `respond'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:107:in `respond_to'
        /var/www/apps/foreman/app/controllers/reports_controller.rb:31:in `create'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `send'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `perform_action_without_filters'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `run_before_filters'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/filters.rb:206:in `call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/filters.rb:206:in `around_proc'
        /var/www/apps/foreman/vendor/rails/activesupport/lib/active_support/callbacks.rb:182:in `call'
        /var/www/apps/foreman/vendor/rails/activesupport/lib/active_support/callbacks.rb:182:in `evaluate_method'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/filters.rb:184:in `call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/filters.rb:635:in `run_before_filters'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/filters.rb:615:in `call_filters'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
        /var/www/apps/foreman/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
        /usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
        /var/www/apps/foreman/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:438:in `call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/vendor/rack-1.0.0-git/lib/rack/head.rb:9:in `call'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/vendor/rack-1.0.0-git/lib/rack/methodoverride.rb:24:in `call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:177:in `call'
        /var/www/apps/foreman/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
        /var/www/apps/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
        /var/www/apps/foreman/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
        /var/www/apps/foreman/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
        /var/www/apps/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/vendor/rack-1.0.0-git/lib/rack/lock.rb:11:in `call'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/vendor/rack-1.0.0-git/lib/rack/lock.rb:11:in `synchronize'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/vendor/rack-1.0.0-git/lib/rack/lock.rb:11:in `call'
        /var/www/apps/foreman/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:106:in `call'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/rack/request_handler.rb:81:in `process_request'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_request_handler.rb:203:in `main_loop'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/railz/application_spawner.rb:340:in `start_request_handler'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/railz/application_spawner.rb:298:in `handle_spawn_application'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/utils.rb:182:in `safe_fork'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/railz/application_spawner.rb:296:in `handle_spawn_application'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in `__send__'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in `main_loop'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:187:in `start_synchronously'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:154:in `start'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/railz/application_spawner.rb:192:in `start'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:257:in `spawn_rails_application'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:251:in `spawn_rails_application'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:250:in `spawn_rails_application'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:153:in `spawn_application'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:282:in `handle_spawn_application'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in `__send__'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in `main_loop'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:187:in `start_synchronously'
        /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2/bin/passenger-spawn-server:61

Here's the fragment of a 2.6.2 report that it's trying to import:

    resources: !ruby/object:Puppet::Util::Metric
      label: Resources
      name: resources
      values:
        - - !ruby/sym total
          - Total
          - 381

I believe it's caused by missing metrics:

METRIC = %w[applied restarted failed failed_restarts skipped]


Related issues

Related to Foreman - Bug #394: Reports do not work - total time is no longer a report meetric in puppet 2.6Closed2010-10-01
Is duplicate of Foreman - Bug #406: wrong report iconDuplicate2010-10-14
Is duplicate of Foreman - Bug #408: Can't see activity for puppet agent 2.6.2 on view "Host Detail"Duplicate2010-10-18

Associated revisions

Revision 4cbaa406 (diff)
Added by Ohad Levy over 10 years ago

Fixes #405 and Fixes #349 - Adds support to 2.6.x reports

NOTE: Its recommended to Backup your DB prior to using this patch.

Revision 27ecacf5 (diff)
Added by Ohad Levy over 10 years ago

Fixed an issue with metric processing on 0.25.x reports, refs #405

History

#1 Updated by Ohad Levy over 10 years ago

  • Category set to Puppet Reports
  • Status changed from New to Assigned
  • Assignee set to Ohad Levy
  • Target version set to 0.1-6

#2 Updated by Ohad Levy over 10 years ago

  • Status changed from Assigned to Duplicate

#3 Updated by Ohad Levy over 10 years ago

  • Status changed from Duplicate to Assigned

#4 Updated by Ohad Levy over 10 years ago

Andrew Forgue wrote:

Our foreman install stopped processing reports after 2.6.2 upgrade.

Here's a stacktrace:

[...]

Here's the fragment of a 2.6.2 report that it's trying to import:

[...]

I believe it's caused by missing metrics:

METRIC = %w[applied restarted failed failed_restarts skipped]

You are correct, the Metric names has changed in 2.6, and there is no longer a resolution of something that got restarted,rather then how many resources changed.

It is clear that in order to support both version of puppet (pre2.6 and 2.6 onwards) a more generic approch is required.

I'll try to fix this and #349 in one go....

#5 Updated by Ohad Levy over 10 years ago

I am uncertain of why you got the specific error message, looking at http://github.com/puppetlabs/puppet/blob/2.6.2/lib/puppet/util/metric.rb#L17, there would always be a value for a metric, so why did you get back a nil value....

can you provide me the report in question? which version of puppet was it on the client and master?

thanks,
Ohad

#6 Updated by Ohad Levy over 10 years ago

  • Priority changed from Normal to High

#7 Updated by Ohad Levy over 10 years ago

Patch added.

this requires tests, please provide feedback.

Please backup your DB first, as this patch changes changes the reporting db structure.

#8 Updated by Ohad Levy over 10 years ago

  • Status changed from Assigned to Ready For Testing
  • % Done changed from 0 to 90

#9 Updated by Ohad Levy over 10 years ago

I've find out an issue with MySQL indexes, attached is an update of the patch - please revisit.

thanks,
Ohad

#10 Updated by Ohad Levy over 10 years ago

  • % Done changed from 90 to 100

#11 Updated by Ohad Levy over 10 years ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF