diff --git a/manifests/init.pp b/manifests/init.pp index 8d93808..66272f2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -262,6 +262,19 @@ } if ($facts['os']['family'] == 'Suse' and $facts['os']['release']['major'] =~ /12|15/) { + # Since Suse 15.4 the file /etc/modprobe.d/10-unsupported-modules.conf isn't created automatically anymore. + # So we need to create that file ourself. An alternative approach could be to use the kmod module. + if versioncmp($facts['os']['release']['full'], '15.3') == 1 { # Suse version is greater than 15.3 + file { '/etc/modprobe.d/10-unsupported-modules.conf' : + ensure => 'file', + path => '/etc/modprobe.d/10-unsupported-modules.conf', + owner => 'root', + group => 'root', + mode => '0644', + before => 'File_line[allow_unsupported_modules]', + } + } + file_line { 'allow_unsupported_modules': ensure => 'present', path => '/etc/modprobe.d/10-unsupported-modules.conf', diff --git a/spec/classes/suse_specifics_spec.rb b/spec/classes/suse_specifics_spec.rb new file mode 100644 index 0000000..51fc38b --- /dev/null +++ b/spec/classes/suse_specifics_spec.rb @@ -0,0 +1,86 @@ +# For SLED/SLES we need individual tests for each affected minor release. +# Since this is not possible with rspec-puppet-facts, explicit tests are +# necessary here. +# +# With SLES 15.4 the path to the modprobe.d directory got changed from +# /etc/modprobe.d to /lib/modprobe.d. + +require 'spec_helper' +describe 'afs' do + platforms = { + 'SLES-15.2 x86_64' => { + os: { + family: 'Suse', + name: 'SLES', + release: { + full: '15.2', + major: '15', + } + } + }, + 'SLES-15.3 x86_64' => { + os: { + family: 'Suse', + name: 'SLES', + release: { + full: '15.3', + major: '15', + } + } + }, + 'SLES-15.4 x86_64' => { + os: { + family: 'Suse', + name: 'SLES', + release: { + full: '15.4', + major: '15', + } + } + }, + 'SLES-15.5 x86_64' => { + os: { + family: 'Suse', + name: 'SLES', + release: { + full: '15.5', + major: '15', + } + } + }, + } + + describe 'with default values for parameters' do + platforms.sort.each do |_k, v| + context "where [os][name] is <#{v[:os][:name]}-#{v[:os][:release][:full]}>" do + let :facts do + { + os: { + family: v[:os][:family], + name: v[:os][:name], + release: { + full: v[:os][:release][:full], + major: v[:os][:release][:major], + } + } + } + end + + it { is_expected.to compile.with_all_deps } + + if v[:os][:release][:full].to_f >= 15.4 + it do + is_expected.to contain_file('/etc/modprobe.d/10-unsupported-modules.conf').with( + 'ensure' => 'file', + 'path' => '/etc/modprobe.d/10-unsupported-modules.conf', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'before' => 'File_line[allow_unsupported_modules]', + ) + end + end + end + end + end +end