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

Converge fails on RHEL systems; setools package does not exist in core repository #34

Closed carldjohnston closed 7 years ago

carldjohnston commented 7 years ago

Cookbook version

1.0.1

Chef-client version

12.8.1

Platform Details

RedHat / Oracle Linux 7.x (without "optional" repository)

Scenario:

Converging a node with selinux::default in the run list. Fails with error of missing 'setools' package.

Steps to Reproduce:

Converge EL6/7 node with selinux::default in the run list.

Expected Result:

Converges successfully, 'setools' package not (or optionally with node attribute) installed.

Actual Result:

Fails with error caused by the package 'setools' not being available on RHEL systems without 'optional' repository.

Appears to be caused by additional packages being added to resources/install.rb in commit 2345f232fa78e8804f5da6d04fafa0c38f228b4c - prior to version 1.0.0 converges were successful and only installed 'libselinux-utils'.

       Recipe: selinux::default
         * selinux_install[selinux os prep] action install[2017-03-01T03:09:12+00:00] INFO: Processing selinux_install[selinux os prep] action install (selinux::default line 19)

           * yum_package[policycoreutils] action install[2017-03-01T03:09:12+00:00] INFO: Processing yum_package[policycoreutils] action install (/tmp/kitchen/cache/cookbooks/selinux/resources/install.rb line 12)
        (up to date)
           * yum_package[selinux-policy] action install[2017-03-01T03:09:12+00:00] INFO: Processing yum_package[selinux-policy] action install (/tmp/kitchen/cache/cookbooks/selinux/resources/install.rb line 13)
        (up to date)
           * yum_package[selinux-policy-targeted] action install[2017-03-01T03:09:12+00:00] INFO: Processing yum_package[selinux-policy-targeted] action install (/tmp/kitchen/cache/cookbooks/selinux/resources/install.rb line 14)
        (up to date)
           * yum_package[setools] action install[2017-03-01T03:09:12+00:00] INFO: Processing yum_package[setools] action install (/tmp/kitchen/cache/cookbooks/selinux/resources/install.rb line 15)

             * No candidate version available for setools
             ================================================================================
             Error executing action `install` on resource 'yum_package[setools]'
             ================================================================================

             Chef::Exceptions::Package
             -------------------------
             No candidate version available for setools

             Resource Declaration:
             ---------------------
             # In /tmp/kitchen/cache/cookbooks/selinux/resources/install.rb

       15:     package 'setools'
       16:     package 'setools-console'

             Compiled Resource:
             ------------------
             # Declared in /tmp/kitchen/cache/cookbooks/selinux/resources/install.rb:15:in `block in class_from_file'

             yum_package("setools") do
        package_name "setools"
        action [:install]
        retries 0
        retry_delay 2
        default_guard_interpreter :default
        declared_type :package
        cookbook_name "selinux"
        flush_cache {:before=>false, :after=>false}
             end

             Platform:
             ---------
             x86_64-linux

       [2017-03-01T03:09:50+00:00] INFO: Running queued delayed notifications before re-raising exception

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

           Chef::Exceptions::Package
           -------------------------
           yum_package[setools] (/tmp/kitchen/cache/cookbooks/selinux/resources/install.rb line 15) had an error: Chef::Exceptions::Package: No candidate version available for setools

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/selinux/recipes/default.rb

            19: selinux_install 'selinux os prep'
            20:

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/selinux/recipes/default.rb:19:in `from_file'

           selinux_install("selinux os prep") do
             action [:install]
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             declared_type :selinux_install
             cookbook_name "selinux"
             recipe_name "default"
           end

           Platform:
           ---------
           x86_64-linux
iennae commented 7 years ago

Thanks for reporting this issue. Can you provide more information for your platform that you are doing this on? Was it Oracle Linux or RHEL or did you test on both?

iennae commented 7 years ago

I've updated the install based on Oracle documentation, version 1.0.2 should resolve this for you. Thanks for reporting this issue.

carldjohnston commented 7 years ago

Thanks for looking at this @iennae, the issue is with both RHEL 7.x and Oracle Linux 7.x; In or organisation, neither of these distro's have access to the "optional" repository by default.

iennae commented 7 years ago

Appreciate you giving more context!