Project

General

Profile

Actions

Feature #17909

closed

Add pending states to app/services/foreman_salt/report_importer.rb

Added by Arthur Lutz about 8 years ago. Updated almost 8 years ago.

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

Description

In import_log_messages in app/services/foreman_salt/report_importer.rb the following code is used to categorise the level of the log message :

        level = if result['changes'].blank? && result['result']
                  :info
                elsif !result['result']
                  :err
                else
                  :notice
                end

I would like to modify this to include a pending state. Looking at the json that is send to foreman and is processed by the Actions::ForemanSalt::ReportImport it seems that "result"=>nil is used for pending tasks (reported by highstate test=True).

     "file_|-/etc/apt/apt.conf.d/99proxy_|-/etc/apt/apt.conf.d/99proxy_|-managed"=>
   {"comment"=>"The file /etc/apt/apt.conf.d/99proxy is set to be changed",
       "name"=>"/etc/apt/apt.conf.d/99proxy",
       "start_time"=>"15:49:36.956739",
       "result"=>nil,
       "duration"=>98.197,
       "__run_num__"=>99,
       "changes"=>
        {"diff"=>
          "--- \n+++ \n@@ -2,4 +2,4 @@\n new content;\n"}},

Am a complete newbie in ruby, could someone help me out adding this elsif ?

Actions #1

Updated by Anonymous about 8 years ago

Please see app/helpers/reports_helper.rb and app/models/report.rb in the Foreman core source for the available severities and their handling. I guess the only sensible thing that can be done here is to map "pending" to the closest available state.

Actions #2

Updated by Anonymous almost 8 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF