foreman_kernel_care 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f86d4ec92298514c54e1e1969fa5a2fb7cd7c03ab73231d86254cc3bc7fef433
4
- data.tar.gz: bf641ebb676ef91fffb9a0fabb9def7321352dd721483404b0a85b27a8c76e01
3
+ metadata.gz: d48df9124313a81b6ed28245a2a54447b1feca758c16087f5e5d638fd1208f83
4
+ data.tar.gz: 1af5606d485f619452eef174fe84c849225a676da2e47498364b5d1bf45c1438
5
5
  SHA512:
6
- metadata.gz: ba271df050549eacca5d79ed6383e7b5a7e822dc9940d06a3ca238c5224c4746e621c3d455806513c8e5d00470e31692f4fa5129523b30344ff8c257bff208ce
7
- data.tar.gz: 861ca0eba4d135a8ad5643175cee8cfba7b5043691c6eaaaf7dad811b484fd252d027098a73474b94c48e6424cc1b46c6fa0e1e3a59dcb56fc7140a5825183f9
6
+ metadata.gz: b5923597240288d47b3fdd6342be6450f0645f8a2c885cc07899505a8d81125c8c1dfcf97b180714c074801554c435d695f57063b951664f7eed6ed1ca0a7e14
7
+ data.tar.gz: 1cc8476969f489892f0708edd5d02f66ff81e0359d80da84ede35e1783609fdd073364e3c8ae84db5029dde7f340c37ca34db696ff3b3ecdf5f5185fbcbb5276
@@ -12,7 +12,9 @@ module ForemanKernelCare
12
12
  complete_output = ''
13
13
  result = payload[:data].to_unsafe_h['result']
14
14
  result.each { |x| complete_output += x['output'] }
15
- kcare, kernel = complete_output.split(/\n/).values_at(1, 3)
15
+ kernel, kcare = complete_output.split(/\n/)
16
+ kernel = kernel.gsub('Installed kernel version: ', '')
17
+ kcare = kcare.gsub('Patched kernel version: ', '')
16
18
  version, release = kcare.strip.split('-')
17
19
  next if version.empty? || release.empty?
18
20
  job_invocation = ::JobInvocation.where(:task_id => foreman_task.parent_task_id).first
@@ -48,8 +48,13 @@ module ForemanKernelCare
48
48
  end
49
49
  end
50
50
 
51
+ def kernelcare?
52
+ !installed_packages.select { |package| package.name == 'kernelcare' }.empty? ||
53
+ !installed_debs.select { |package| package.name == 'kernelcare' }.empty?
54
+ end
55
+
51
56
  class ::Host::Managed::Jail < Safemode::Jail
52
- allow :installed_debs
57
+ allow :installed_debs, :kernelcare?
53
58
  end
54
59
 
55
60
  protected
@@ -138,10 +143,5 @@ module ForemanKernelCare
138
143
  self.installed_deb_ids = new_installed_debs.concat(new_patched_kernel_ids)
139
144
  save!
140
145
  end
141
-
142
- def kernelcare?
143
- !installed_packages.select { |package| package.name == 'kernelcare' }.empty? ||
144
- !installed_debs.select { |package| package.name == 'kernelcare' }.empty?
145
- end
146
146
  end
147
147
  end
@@ -0,0 +1,15 @@
1
+ module ForemanKernelCare
2
+ module ProfilesUploader
3
+ extend ActiveSupport::Concern
4
+
5
+ def import_deb_package_profile(profile)
6
+ if @host.kernelcare?
7
+ composer = ::JobInvocationComposer.for_feature(:kernel_version, @host)
8
+ composer.triggering.mode = :future
9
+ composer.trigger!
10
+ end
11
+
12
+ super(profile)
13
+ end
14
+ end
15
+ end
@@ -9,7 +9,7 @@ feature: kernel_version
9
9
  %>
10
10
  <%
11
11
  unless @host.installed_packages.map{ |package| package.name }.include?('kernelcare') || @host.installed_debs.map{ |package| package.name }.include?('kernelcare')
12
- render_error(N_('Unsupported host.'))
12
+ render_error(N_('The "kernelcare" package is not installed on your managed host which is required by this job template.'))
13
13
  end
14
14
  %>
15
15
 
@@ -10,7 +10,7 @@ feature: update_kernel
10
10
 
11
11
  <%
12
12
  unless @host.installed_packages.map{ |package| package.name }.include?('kernelcare') || @host.installed_debs.map{ |package| package.name }.include?('kernelcare')
13
- render_error(N_('Unsupported host.'))
13
+ render_error(N_('The "kernelcare" package is not installed on your managed host which is required by this job template.'))
14
14
  end
15
15
  %>
16
16
 
@@ -3,12 +3,12 @@ kind: job_template
3
3
  name: LivePatching - View newest Patch
4
4
  model: JobTemplate
5
5
  job_category: LivePatching - Script Default
6
- description_format: "Get patched kernel version"
6
+ description_format: "View available patches"
7
7
  provider_type: script
8
8
  %>
9
9
  <%
10
10
  unless @host.installed_packages.map{ |package| package.name }.include?('kernelcare') || @host.installed_debs.map{ |package| package.name }.include?('kernelcare')
11
- render_error(N_('Unsupported host.'))
11
+ render_error(N_('The "kernelcare" package is not installed on your managed host which is required by this job template.'))
12
12
  end
13
13
  %>
14
14
 
@@ -8,6 +8,7 @@ module ForemanKernelCare
8
8
  engine_name 'foreman_kernel_care'
9
9
 
10
10
  config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
11
+ config.autoload_paths += Dir["#{config.root}/app/services/concerns"]
11
12
 
12
13
  initializer 'foreman_kernel_care.register_plugin', :before => :finisher_hook do |_app|
13
14
  Foreman::Plugin.register :foreman_kernel_care do
@@ -19,6 +20,7 @@ module ForemanKernelCare
19
20
  # make sure the plugin is initialized before katello loads the host extensions
20
21
  initializer 'foreman_kernel_care.load_kernelcare_override', :before => :finisher_hook, :after => ['katello.register_plugin', 'foreman_tasks.register_plugin'] do
21
22
  ::Katello::Concerns::HostManagedExtensions.prepend ForemanKernelCare::HostManagedExtensions
23
+ ::Katello::Host::ProfilesUploader.prepend ForemanKernelCare::ProfilesUploader
22
24
  ::ForemanTasks::Api::TasksController.prepend ForemanKernelCare::ForemanTasks
23
25
  end
24
26
 
@@ -1,3 +1,3 @@
1
1
  module ForemanKernelCare
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_kernel_care
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Petukhov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-28 00:00:00.000000000 Z
11
+ date: 2023-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman_remote_execution
@@ -99,6 +99,7 @@ files:
99
99
  - Rakefile
100
100
  - app/controllers/concerns/foreman_kernel_care/foreman_tasks.rb
101
101
  - app/models/concerns/foreman_kernel_care/host_managed_extensions.rb
102
+ - app/services/concerns/foreman_kernel_care/profiles_uploader.rb
102
103
  - app/views/foreman_kernel_care/job_templates/install_kernelcare.erb
103
104
  - app/views/foreman_kernel_care/job_templates/kernel_version.erb
104
105
  - app/views/foreman_kernel_care/job_templates/update_kernel.erb