Skip to content

Commit

Permalink
Kernel version template output parsing fix (#56)
Browse files Browse the repository at this point in the history
* Update job template description for patch viewing

* Correct output parsing of kernel version job
  • Loading branch information
nadjaheitmann authored Oct 10, 2023
1 parent b6eb067 commit 2429eae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Metrics/PerceivedComplexity:
Max: 10

Metrics/MethodLength:
Max: 18
Max: 19

Metrics/ModuleLength:
Max: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ def callback
complete_output = ''
result = payload[:data].to_unsafe_h['result']
result.each { |x| complete_output += x['output'] }
kcare, kernel = complete_output.split(/\n/).values_at(1, 3)
kernel, kcare = complete_output.split(/\n/)
kernel = kernel.gsub('Installed kernel version: ', '')
kcare = kcare.gsub('Patched kernel version: ', '')
version, release = kcare.strip.split('-')
next if version.empty? || release.empty?
job_invocation = ::JobInvocation.where(:task_id => foreman_task.parent_task_id).first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: job_template
name: LivePatching - View newest Patch
model: JobTemplate
job_category: LivePatching - Script Default
description_format: "Get patched kernel version"
description_format: "View available patches"
provider_type: script
%>
<%
Expand Down

0 comments on commit 2429eae

Please sign in to comment.