Browse Source

Add ability to install kernel related packages

Added support to have the kernel class install packages prior to the
kmod loading.

Change-Id: I6085bcd2f91f84577dcf59d3c93afb24ab718a49
Related-Bug: #1840180
(cherry picked from commit cf8dc4658a)
tags/8.5.1
Alex Schultz 1 month ago
parent
commit
81bc798ae0
2 changed files with 29 additions and 0 deletions
  1. 16
    0
      manifests/profile/base/kernel.pp
  2. 13
    0
      spec/classes/tripleo_profile_base_kernel_spec.rb

+ 16
- 0
manifests/profile/base/kernel.pp View File

@@ -23,18 +23,34 @@
23 23
 #   (Optional) List of kernel modules to load.
24 24
 #   Defaults to hiera('kernel_modules')
25 25
 #
26
+# [*package_list*]
27
+#   (Optional) List of additional kernel related packages to load
28
+#   Defaults to hiera('kernel_packages')
29
+#
26 30
 # [*sysctl_settings*]
27 31
 #   (Optional) List of sysctl settings to load.
28 32
 #   Defaults to hiera('sysctl_settings')
29 33
 #
30 34
 class tripleo::profile::base::kernel (
31 35
   $module_list     = hiera('kernel_modules', undef),
36
+  $package_list    = hiera('kernel_packages', undef),
32 37
   $sysctl_settings = hiera('sysctl_settings', undef),
33 38
 ) {
34 39
 
35 40
   if $module_list {
36 41
     create_resources(kmod::load, $module_list, { })
37 42
   }
43
+
44
+  if $package_list {
45
+    $pkg_defaults = {
46
+      'tag' => 'kernel-package'
47
+    }
48
+    create_resources(package, $package_list, $pkg_defaults)
49
+    # ensure we install the package prior to trying to load kmods to make sure
50
+    # if the package list includes a kmod that it will be available.
51
+    Package<| tag == 'kernel-package' |> -> Exec<| tag == 'kmod::load' |>
52
+  }
53
+
38 54
   if $sysctl_settings {
39 55
     create_resources(sysctl::value, $sysctl_settings, { })
40 56
   }

+ 13
- 0
spec/classes/tripleo_profile_base_kernel_spec.rb View File

@@ -32,6 +32,19 @@ describe 'tripleo::profile::base::kernel' do
32 32
                 is_expected.to contain_kmod__load('nf_conntrack')
33 33
             end
34 34
         end
35
+        context 'with packages' do
36
+           let :params do
37
+               {
38
+                   :package_list => {
39
+                     'kmod_special' => {},
40
+                   }
41
+               }
42
+           end
43
+
44
+            it 'should install package' do
45
+              is_expected.to contain_package('kmod_special').with('tag' => 'kernel-package')
46
+            end
47
+        end
35 48
         context 'with sysctl settings' do
36 49
            let :params do
37 50
                {

Loading…
Cancel
Save