foreman_kernel_care 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/foreman_kernel_care/foreman_tasks.rb +3 -1
- data/app/models/concerns/foreman_kernel_care/host_managed_extensions.rb +7 -7
- data/app/services/concerns/foreman_kernel_care/profiles_uploader.rb +15 -0
- data/app/views/foreman_kernel_care/job_templates/kernel_version.erb +1 -1
- data/app/views/foreman_kernel_care/job_templates/update_kernel.erb +1 -1
- data/app/views/foreman_kernel_care/job_templates/view_newest_patch.erb +2 -2
- data/lib/foreman_kernel_care/engine.rb +2 -0
- data/lib/foreman_kernel_care/version.rb +1 -1
- data/test/factories/foreman_kernel_care_factories.rb +1 -1
- data/test/unit/host_managed_extensions_test.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 947deca95e8a08c814f7b99190ac2a6c8b06fcf7c4f2ed6a66d29085e92b7d74
|
4
|
+
data.tar.gz: 80bc80494c32c62476008e06a64ec1d6a5c0772fa4dd32fe9a9769347e714d96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e6574273325790a40827dbbe2af947e5c44536969d02590fffe54a547d5446f84fff5476cf605de7cca6b728b0b5237b3f60b44f76fc74472cce91efdea02a8
|
7
|
+
data.tar.gz: 00607be4c09856522537fafa43584018245e864f8db18b5e521d6b8fe1d31ba6f12c78cdaacb7c7bf7ab089dff11d02d4cad2e2052449f0afd1f91e4b079c4c9
|
@@ -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
|
-
|
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
|
@@ -81,7 +86,7 @@ module ForemanKernelCare
|
|
81
86
|
|
82
87
|
def create_new_yum_kernel_packages(packages, version, release)
|
83
88
|
new_kernels = packages.map do |p|
|
84
|
-
::Katello::
|
89
|
+
::Katello::SimplePackage.new({
|
85
90
|
arch: p.arch,
|
86
91
|
epoch: p.epoch,
|
87
92
|
version: version,
|
@@ -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_('
|
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_('
|
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: "
|
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_('
|
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
|
|
@@ -19,7 +19,7 @@ FactoryBot.modify do
|
|
19
19
|
:epoch => '1',
|
20
20
|
:nvra => 'kernelcare-2.54-1.el7.x86_64'
|
21
21
|
}
|
22
|
-
host.import_package_profile([::Katello::
|
22
|
+
host.import_package_profile([::Katello::SimplePackage.new(package_json)])
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -18,7 +18,7 @@ module ForemanKernelCare
|
|
18
18
|
package_json = { :name => 'kernel', :version => '1',
|
19
19
|
:release => '1.el7', :arch => 'x86_64', :epoch => '1',
|
20
20
|
:nvra => 'kernel-1-1.el7.x86_64' }
|
21
|
-
host.import_package_profile([::Katello::
|
21
|
+
host.import_package_profile([::Katello::SimplePackage.new(package_json)])
|
22
22
|
nvra = 'kernel-1-1.el7.x86_64'
|
23
23
|
host.reload
|
24
24
|
version = '2'
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxim Petukhov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foreman_remote_execution
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.8.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 4.8.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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
|
@@ -132,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
133
|
- !ruby/object:Gem::Version
|
133
134
|
version: '0'
|
134
135
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
136
|
+
rubygems_version: 3.4.10
|
136
137
|
signing_key:
|
137
138
|
specification_version: 4
|
138
139
|
summary: Plugin for KernelCare
|