sensu / sensu-chef

Sensu Chef cookbook.
https://supermarket.chef.io/cookbooks/sensu
Apache License 2.0
222 stars 283 forks source link

Install fails on RHEL8 clients #634

Open jmercier-ndp opened 3 years ago

jmercier-ndp commented 3 years ago

Due to the fact that the _linux recipe expressly calls yum_package, which no longer works on RHEL8 due to migration to DNF, I get the following error:

  * yum_package[sensu] action install[2020-09-10T16:35:03+00:00] INFO: Processing yum_package[sensu] action install (sensu::_linux line 82)
nil versions are discouraged and will be deprecated in Rubygems 4

    ================================================================================
    Error executing action `install` on resource 'yum_package[sensu]'
    ================================================================================

    Chef::Exceptions::Package
    -------------------------
    cannot find yum libraries, you may need to use dnf_package

Chef is usually smart enough to know which package manager to use, so the explicit call to yum_package seems unnecessary. If I modify this to just use "package" it works as expected since both yum and dnf can use the same yum repositories.

Expected Behavior

The recipe should install Sensu using "package" and allow chef-client to detect the proper package manager.

The recipe should install Sensu using "package" and allow chef-client to detect the proper package manager.

As you can see at:

https://github.com/chef/chef/blob/6e0e0be6eb588434751ab4dcae86cca872858e8b/lib/chef/provider/package/yum/python_helper.rb#L47

this is expected behavior when you try to use yum_package on a system without the underlying python libraries for yum.

Current Behavior

You get the failure above.

Possible Solution

Simply update _linux to use package instead of yum_package and let chef-client use whichever is appropriate.

Steps to Reproduce (for bugs)

  1. Have a working yum respository set up by hand or your wrapper cookbook
  2. Run sensu::default

Context

I am simply trying to install/configure sensu (client) using the sensu cookbook. It doesn't work on RHEL8 nodes.

Your Environment