sous-chefs / selinux

Development repository for the selinux cookbook
https://supermarket.chef.io/cookbooks/selinux
Apache License 2.0
58 stars 70 forks source link

Cookbook version 6.0.6 fails on Centos6 due to missing packages #88

Closed neha-p6 closed 1 year ago

neha-p6 commented 1 year ago

:speaking_head: Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

:ghost: Brief Description

Recently this change https://github.com/sous-chefs/selinux/pull/86/files#diff-5565db30a2344a25231464764cd22869a286a582f77502ba806360b2ae69b14cR11 was made to add the policycoreutils-python packages. Due to condition, on a Centos6 system, the cookbook tries to install the package policycoreutils-python-utils which is not available for it and results in failures:

Compiled Resource:
             ------------------
             # Declared in /opt/kitchen/cache/cookbooks/selinux/resources/install.rb:34:in `do_package_action'

             yum_package("selinux") do
        package_name ["make", "policycoreutils", "policycoreutils-python-utils", "selinux-policy", "selinux-policy-targeted", "selinux-policy-devel", "libselinux-utils", "setools-console"]
        action [:install]
        default_guard_interpreter :default
        declared_type :package
        cookbook_name "selinux"
             end

             System Info:
             ------------
             chef_version=16.18.5
             platform=centos
             platform_version=6.10
             ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
             program_name=/opt/chef/bin/chef-client
             executable=/opt/chef/bin/chef-client

           ================================================================================
           Error executing action `install` on resource 'selinux_install[selinux]'
           ================================================================================

           Chef::Exceptions::Package
           -------------------------
           yum_package[selinux] (/opt/kitchen/cache/cookbooks/selinux/resources/install.rb line 34) had an error: Chef::Exceptions::Package: No candidate version available for policycoreutils-python-utils

e.g build log https://github.com/chef/chef/actions/runs/3243294533/jobs/5317799803

:pancakes: Cookbook version

Version of the cookbook where you are encountering the issue: 6.0.6

:woman_cook: Chef-Infra Version

Version of chef-client in your environment: 16.x.x, 17.x.x (Note: Centos6 is dead but since the older chef versions had support for it, Chef's CI pipeline would continue having it for chef16 and 17.)

:tophat: Platform details

Operating system distribution and release version: For run with chef-16

             System Info:
             ------------
             chef_version=16.18.5
             platform=centos
             platform_version=6.10
             ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]

Steps To Reproduce

Steps to reproduce the behavior:

  1. Setup test kitchen with chef-16/17 and centos-6
  2. Create a test cookbook and add dependency for this cookbook in the metadata.rb depends "selinux"
  3. In default recipe use any of the recipe provided by cookbook e.g: include_recipe "selinux::permissive"
  4. kitchen converge to see the error.

:police_car: Expected behavior

SELinux mode getting set to permissive without failures for packages.

:heavy_plus_sign: Additional context

Add any other context about the problem here. e.g. related issues or existing pull requests.