Skip to content
This repository was archived by the owner on Feb 11, 2022. It is now read-only.

Commit efc97b6

Browse files
committed
Merge pull request voxpupuli#44 from jhoblitt/bugfix/fedora-support
fix EL variant != 'RedHat' regression
2 parents 0ab38c1 + 5093294 commit efc97b6

File tree

3 files changed

+38
-40
lines changed

3 files changed

+38
-40
lines changed

manifests/params.pp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
case $::osfamily {
1414
'RedHat': {
1515
case $::operatingsystem {
16-
'RedHat': {
16+
'Fedora': {
17+
$sx_fs_mount = '/sys/fs/selinux'
18+
$package_name = 'policycoreutils-python'
19+
}
20+
default: {
1721
case $::operatingsystemmajrelease {
1822
'7': {
1923
$sx_fs_mount = '/sys/fs/selinux'
@@ -32,13 +36,6 @@
3236
}
3337
}
3438
}
35-
'Fedora': {
36-
$sx_fs_mount = '/sys/fs/selinux'
37-
$package_name = 'policycoreutils-python'
38-
}
39-
default: {
40-
fail("${::operatingsystem} is not supported")
41-
}
4239
}
4340
}
4441
default: {

spec/classes/selinux_spec.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
require 'spec_helper'
22

33
describe 'selinux' do
4-
context 'Redhat 7' do
5-
include_context 'RedHat 7'
4+
[
5+
'RedHat 7',
6+
'CentOS 7',
7+
'Fedora 22',
8+
].each do |ctx|
9+
context ctx do
10+
include_context ctx
611

7-
it { should contain_class('selinux::package') }
8-
it { should contain_class('selinux::config') }
9-
end
10-
11-
context 'Fedora 22' do
12-
include_context 'Fedora 22'
13-
14-
it { should contain_class('selinux::package') }
15-
it { should contain_class('selinux::config') }
12+
it { should contain_class('selinux::package') }
13+
it { should contain_class('selinux::config') }
14+
end
1615
end
1716
end

spec/spec_helper.rb

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
11
require 'rubygems' if RUBY_VERSION < '1.9.0'
22
require 'puppetlabs_spec_helper/module_spec_helper'
33

4+
facts = {
5+
:osfamily => 'RedHat',
6+
:operatingsystem => 'RedHat',
7+
:operatingsystemmajrelease => '7',
8+
:selinux_current_mode => 'enforcing',
9+
# concat facts
10+
:concat_basedir => '/tmp',
11+
:id => 0,
12+
:is_pe => false,
13+
:path => '/tmp',
14+
}
15+
416
shared_context 'RedHat 7' do
17+
let(:facts) { facts }
18+
end
19+
20+
shared_context 'CentOS 7' do
521
let(:facts) do
6-
{
7-
:osfamily => 'RedHat',
8-
:operatingsystem => 'RedHat',
9-
:operatingsystemmajrelease => '7',
10-
:selinux_current_mode => 'enforcing',
11-
# concat facts
12-
:concat_basedir => '/tmp',
13-
:id => 0,
14-
:is_pe => false,
15-
:path => '/tmp',
16-
}
22+
facts.dup.merge(
23+
:operatingsystem => 'CentOS',
24+
:operatingsystemmajrelease => '7'
25+
)
1726
end
1827
end
1928

2029
shared_context 'Fedora 22' do
2130
let(:facts) do
22-
{
23-
:osfamily => 'RedHat',
31+
facts.dup.merge(
2432
:operatingsystem => 'Fedora',
25-
:operatingsystemmajrelease => '22',
26-
:selinux_current_mode => 'enforcing',
27-
# concat facts
28-
:concat_basedir => '/tmp',
29-
:id => 0,
30-
:is_pe => false,
31-
:path => '/tmp',
32-
}
33+
:operatingsystemmajrelease => '22'
34+
)
3335
end
3436
end

0 commit comments

Comments
 (0)