Showing with 26 additions and 29 deletions.
  1. +6 −0 CHANGELOG.md
  2. +0 −19 lib/facter/selinux_custom_policy.rb
  3. +1 −1 manifests/config.pp
  4. +3 −8 manifests/module.pp
  5. +1 −1 metadata.json
  6. +15 −0 spec/defines/selinux_module_spec.rb
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 2016-12-14 Release 0.7.0

- Remove custom fact selinux_custom_policy (not used anymore)
- Default the module prefix to '' (bugfix for CentOS7)


## 2016-12-24 Release 0.6.0

- Modulesync with latest Vox Pupuli defaults
Expand Down
19 changes: 0 additions & 19 deletions lib/facter/selinux_custom_policy.rb

This file was deleted.

2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# Parameters:
# - $mode (enforcing|permissive|disabled) - sets the operating state for SELinux.
# - $type (targeted|minimum|mls) - sets the operating type for SELinux.
# - $type (targeted|minimum|mls) - sets SELinux policy.
# - $manage_package (boolean) - Whether or not to manage the SELinux management package.
# - $package_name (string) - sets the name of the selinux management package.
# - $sx_mod_dir (directory) - sets the operating sx_mod_dir for SELinux.
Expand Down
11 changes: 3 additions & 8 deletions manifests/module.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#
# Parameters:
# - $ensure: (present|absent) - sets the state for a module
# - $sx_mod_dir (absolute_path) - sets the operating state for SELinux.
# - $sx_mod_dir (absolute_path) - sets the module directory.
# - $source: the source file (either a puppet URI or local file) of the SELinux .te module
# - $makefile: the makefile file path
# - $prefix: the prefix to add to the loaded module. Defaults to 'local_'.
# - $prefix: the prefix to add to the loaded module. Defaults to ''.
#
# Actions:
# Compiles a module using make and installs it
Expand All @@ -32,7 +32,7 @@
$content = undef,
$ensure = 'present',
$makefile = '/usr/share/selinux/devel/Makefile',
$prefix = 'local_',
$prefix = '',
$sx_mod_dir = '/usr/share/selinux',
$syncversion = true,
) {
Expand All @@ -54,11 +54,6 @@
validate_absolute_path($makefile)
validate_bool($syncversion)

$selinux_policy = $::selinux_config_policy ? {
/targeted|strict/ => $::selinux_config_policy,
default => $::selinux_custom_policy,
}

## Begin Configuration
file { "${sx_mod_dir}/${prefix}${name}.te":
ensure => $ensure,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-selinux",
"version": "0.6.0",
"version": "0.7.0",
"author": "Vox Pupuli",
"summary": "This class manages SELinux on RHEL based systems",
"license": "Apache-2.0",
Expand Down
15 changes: 15 additions & 0 deletions spec/defines/selinux_module_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
}
end

it do
is_expected.to contain_file('/usr/share/selinux/mymodule.te').that_notifies('Exec[/usr/share/selinux/mymodule.pp]')
is_expected.to contain_exec('/usr/share/selinux/mymodule.pp').with(command: 'make -f /usr/share/selinux/devel/Makefile mymodule.pp')
is_expected.to contain_selmodule('mymodule').with_ensure('present')
end
end

context 'present case and prefix set' do
let(:params) do
{
source: 'puppet:///modules/mymodule/selinux/mymodule.te',
prefix: 'local_'
}
end

it do
is_expected.to contain_file('/usr/share/selinux/local_mymodule.te').that_notifies('Exec[/usr/share/selinux/local_mymodule.pp]')
is_expected.to contain_exec('/usr/share/selinux/local_mymodule.pp').with(command: 'make -f /usr/share/selinux/devel/Makefile local_mymodule.pp')
Expand Down