Skip to content

Commit

Permalink
Fix kitchen test failures on centos6 for chef16/17 in chef's CI pipel…
Browse files Browse the repository at this point in the history
…ine (#89)

* Centos6 doesnot support policycoreutils packages. Update condition so as not to use them on centos6

Signed-off-by: Neha Pansare <[email protected]>

* Lock version to Chef 17 and update Changelog

Signed-off-by: Lance Albertson <[email protected]>

* Fix Chef 18 compatibility

This allows this cookbook to work properly with Chef 18 along with keeping
support for older versions.

Signed-off-by: Lance Albertson <[email protected]>

Signed-off-by: Neha Pansare <[email protected]>
Signed-off-by: Lance Albertson <[email protected]>
Co-authored-by: Lance Albertson <[email protected]>
  • Loading branch information
neha-p6 and ramereth authored Nov 1, 2022
1 parent 112e878 commit 2d8f6f4
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ This file is used to list changes made in each version of the selinux cookbook.

## Unreleased

- Fix CentOS 6 package requirements
- Fix Chef 18 compatibility

## 6.0.6 - *2022-09-28*

- Add missing `policycoreutils-python` package
Expand Down
2 changes: 2 additions & 0 deletions libraries/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ def default_install_packages
case node['platform_family']
when 'rhel'
case node['platform_version'].to_i
when 6
%w(make policycoreutils selinux-policy selinux-policy-targeted selinux-policy-devel libselinux-utils setools-console)
when 7
%w(make policycoreutils policycoreutils-python selinux-policy selinux-policy-targeted selinux-policy-devel libselinux-utils setools-console)
else
Expand Down
4 changes: 2 additions & 2 deletions resources/boolean.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
property :value, [Integer, String, true, false],
required: true,
equal_to: %w(on off),
coerce: proc { |p| SELinux::Cookbook::BooleanHelpers.selinux_bool(p) },
coerce: proc { |p| ::SELinux::Cookbook::BooleanHelpers.selinux_bool(p) },
description: 'SELinux boolean value'

property :persistent, [true, false],
Expand All @@ -37,7 +37,7 @@
end

action_class do
include SELinux::Cookbook::StateHelpers
include ::SELinux::Cookbook::StateHelpers
end

action :set do
Expand Down
2 changes: 1 addition & 1 deletion resources/fcontext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
description: 'The type of the file being labeled'

action_class do
include SELinux::Cookbook::StateHelpers
include ::SELinux::Cookbook::StateHelpers

def current_file_context
file_hash = {
Expand Down
2 changes: 1 addition & 1 deletion resources/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

unified_mode true

include SELinux::Cookbook::InstallHelpers
include ::SELinux::Cookbook::InstallHelpers

property :packages, [String, Array],
default: lazy { default_install_packages },
Expand Down
2 changes: 1 addition & 1 deletion resources/port.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
description: 'SELinux context to assign to the port'

action_class do
include SELinux::Cookbook::StateHelpers
include ::SELinux::Cookbook::StateHelpers

def current_port_context
# use awk to see if the given port is within a reported port range
Expand Down
4 changes: 2 additions & 2 deletions resources/state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

unified_mode true

include SELinux::Cookbook::StateHelpers
include ::SELinux::Cookbook::StateHelpers

default_action :nothing

Expand All @@ -41,7 +41,7 @@
deprecated_property_alias 'temporary', 'persistent', 'The temporary property was renamed persistent in the 4.0 release of this cookbook. Please update your cookbooks to use the new property name.'

action_class do
include SELinux::Cookbook::StateHelpers
include ::SELinux::Cookbook::StateHelpers

def render_selinux_template(action)
Chef::Log.warn(
Expand Down

0 comments on commit 2d8f6f4

Please sign in to comment.