Project

General

Profile

Actions

Bug #36786

closed

Reports parser fails for Salt reports

Added by Bastian Schmidt 8 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

When applying a Salt highstate to a host, the corresponding report cannot be shown. It results in the following error:

2023-09-27T16:32:44 [I|app|8dab0990] Started GET "/config_reports/72" for <xxx> at 2023-09-27 16:32:44 +0200
2023-09-27T16:32:44 [I|app|8dab0990] Processing by ConfigReportsController#show as HTML
2023-09-27T16:32:44 [I|app|8dab0990]   Parameters: {"id"=>"72"}
2023-09-27T16:32:44 [I|app|8dab0990]   Rendered config_reports/show.html.erb within layouts/application (Duration: 22.2ms | Allocations: 17988)
2023-09-27T16:32:44 [I|app|8dab0990]   Rendered layout layouts/application.html.erb (Duration: 22.4ms | Allocations: 18043)
2023-09-27T16:32:44 [W|app|8dab0990] Tried to load unspecified class: Symbol
2023-09-27T16:32:44 [I|app|8dab0990] Backtrace for 'Tried to load unspecified class: Symbol' error (ActionView::Template::Error): Tried to load unspecified class: Symbol
 8dab0990 | /usr/share/ruby/psych/class_loader.rb:97:in `find'
 8dab0990 | /usr/share/ruby/psych/class_loader.rb:28:in `load'
 8dab0990 | /usr/share/ruby/psych/class_loader.rb:39:in `block (2 levels) in <class:ClassLoader>'
 8dab0990 | /usr/share/ruby/psych/class_loader.rb:32:in `symbolize'
 8dab0990 | /usr/share/ruby/psych/class_loader.rb:82:in `symbolize'
 8dab0990 | /usr/share/ruby/psych/scalar_scanner.rb:74:in `tokenize'
 8dab0990 | /usr/share/ruby/psych/visitors/to_ruby.rb:60:in `deserialize'
 8dab0990 | /usr/share/ruby/psych/visitors/to_ruby.rb:123:in `visit_Psych_Nodes_Scalar'
 8dab0990 | /usr/share/ruby/psych/visitors/visitor.rb:16:in `visit'
 8dab0990 | /usr/share/ruby/psych/visitors/visitor.rb:6:in `accept'
 8dab0990 | /usr/share/ruby/psych/visitors/to_ruby.rb:32:in `accept'
 8dab0990 | /usr/share/ruby/psych/visitors/to_ruby.rb:339:in `block in revive_hash'
 8dab0990 | /usr/share/ruby/psych/visitors/to_ruby.rb:338:in `each'
 8dab0990 | /usr/share/ruby/psych/visitors/to_ruby.rb:338:in `each_slice'
 8dab0990 | /usr/share/ruby/psych/visitors/to_ruby.rb:338:in `revive_hash'
 8dab0990 | /usr/share/ruby/psych/visitors/to_ruby.rb:162:in `visit_Psych_Nodes_Mapping'
 8dab0990 | /usr/share/ruby/psych/visitors/visitor.rb:16:in `visit'
 8dab0990 | /usr/share/ruby/psych/visitors/visitor.rb:6:in `accept'
 8dab0990 | /usr/share/ruby/psych/visitors/to_ruby.rb:32:in `accept'
 8dab0990 | /usr/share/ruby/psych/visitors/to_ruby.rb:313:in `visit_Psych_Nodes_Document'
 8dab0990 | /usr/share/ruby/psych/visitors/visitor.rb:16:in `visit'
 8dab0990 | /usr/share/ruby/psych/visitors/visitor.rb:6:in `accept'
 8dab0990 | /usr/share/ruby/psych/visitors/to_ruby.rb:32:in `accept'
 8dab0990 | /usr/share/ruby/psych.rb:360:in `safe_load'
 8dab0990 | /usr/share/foreman/app/models/report.rb:65:in `metrics'
 8dab0990 | /usr/share/foreman/app/views/config_reports/show.html.erb:16:in `_30af4dc6d652781c60dd10b1845f1335'

I've inspected the content of the report.metrics attribute and it looks like the following:

" 
report[:metrics]
---
:events:
  :total: 1
  :success: 1
  :failure: 0
:resources:
  total: 1
  applied: 1
  restarted: 0
  failed: 0
  failed_restarts: 0
  skipped: 0
  scheduled: 0
  pending: 0
:changes:
  :total: 1
:time:
  file_|-/etc/motd_|-/etc/motd_|-managed: 0.33620999999999995
  :total: 0.33620999999999995" 

Here, the issue seems to be that an attribute starts with colon, like :events: which is an issue for the YAML parser.

The corresponding code that takes care of parsing the metrics can be found in app/models/report.rb:65

Actions #1

Updated by The Foreman Bot 8 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/9844 added
Actions #2

Updated by The Foreman Bot 8 months ago

  • Fixed in Releases 3.9.0 added
Actions #3

Updated by Bastian Schmidt 8 months ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF