Feature #17909
closedAdd pending states to app/services/foreman_salt/report_importer.rb
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 ?
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.
Updated by Anonymous almost 8 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
Applied in changeset foreman_salt|2497ae4b78c335c8270393a73cce468cf3a6c659.