Skip to content

Commit

Permalink
(SIMP-2948) Use selinux status instead of catalyst (#52)
Browse files Browse the repository at this point in the history
rsyslog::server used to use simp_options::selinux to determine if
selinux should be modified. Now it uses the current state of the system.

SIMP-2948 #close
  • Loading branch information
Nick Miller authored and Nick Markowski committed Mar 31, 2017
1 parent f169fc4 commit 14f0ef4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Tue Mar 28 2017 Nick Miller <[email protected]> - 7.0.2-0
- rsyslog::server now uses the state of selinux on the system instead
of simp_options

* Thu Mar 23 2017 Jeanne Greulich <[email protected]> - 7.0.2-0
- Updated path for systemctl

Expand Down
2 changes: 1 addition & 1 deletion manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
class rsyslog::server (
Boolean $enable_firewall = simplib::lookup('simp_options::firewall', { 'default_value' => false }),
Boolean $enable_selinux = simplib::lookup('simp_options::selinux', { 'default_value' => false }),
Boolean $enable_selinux = $facts['selinux_enforced'],
Boolean $enable_tcpwrappers = simplib::lookup('simp_options::tcpwrappers', { 'default_value' => false })
) {
include '::rsyslog'
Expand Down
5 changes: 2 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": "4.x"
"version_requirement": ">= 4.6.0 < 5.0.0"
}
],
"data_provider": "hiera"
]
}
19 changes: 14 additions & 5 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,23 @@
it { is_expected.to create_class('rsyslog::server') }
it { is_expected.to contain_class('rsyslog') }
it { is_expected.to contain_class('rsyslog::server') }
it { is_expected.to contain_class('rsyslog::server::selinux') }
end

context 'supported operating systems' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts[:selinux_current_mode] = 'disabled'
facts
end

context 'rsyslog::server class without any parameters' do
let(:params) {{ }}
it_behaves_like 'a structured module'
it { is_expected.not_to contain_class('rsyslog::server::firewall') }
it { is_expected.not_to contain_class('rsyslog::server::tcpwrappers') }
it { is_expected.not_to create_selboolean('nis_enabled') }
end

context 'rsyslog::server class with firewall enabled' do
Expand Down Expand Up @@ -98,18 +103,22 @@
end

context 'rsyslog::server class with SELinux enabled' do
let(:params) {{
:enable_selinux => true
}}
###it_behaves_like 'a structured module'
let(:facts) {facts.merge({ :selinux_current_mode => 'enforcing' })}
it_behaves_like 'a structured module'
it { is_expected.to contain_class('rsyslog::server::selinux') }
if facts[:os][:release][:major].to_i > 6
it { is_expected.to create_selboolean('nis_enabled').with({
:persistent => true,
:value => 'on'
}) }
end
end

context 'rsyslog::server class with TCPWrappers enabled' do
let(:params) {{
:enable_tcpwrappers => true
}}
###it_behaves_like 'a structured module'
it_behaves_like 'a structured module'
it { is_expected.to contain_class('rsyslog::server::tcpwrappers') }
end

Expand Down

0 comments on commit 14f0ef4

Please sign in to comment.