Mark Nichols
Mark Nichols

Reputation: 1503

yum_package resource in Chef not working on CentOS 8

Previous we had been using RHEL 7.2 for some servers. We are switching to CentOS 8. The following resource works on RHEL, but fails on CentOS.

%w[ed rsync nmap telnet vim bash-completion].each do |package|
    yum_package package do
        action :install
    end
end

The error is this:

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

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /usr/libexec/platform-python /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.1/lib/chef/provider/package/yum/yum-dump.py --options --installed-provides --yum-lock-timeout 30 ----
STDOUT: 
STDERR: File "/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.1/lib/chef/provider/package/yum/yum-dump.py", line 72
    except yum.Errors.ConfigError, e:
                                 ^
SyntaxError: invalid syntax

By editing the yum-dump.py file and changing the line in question to be

except yum.Errors.ConfigError as e:

I can eliminate the error. On that line. The next except occurrence then fails.

I tried installing python2, which didn't help. And I tried removing python3 so that only python2 was available, which also didn't help. How can I update the yum package to one that is syntactically correct?

Upvotes: 0

Views: 1034

Answers (1)

Sri
Sri

Reputation: 9

Change from

yum_package ['git'] do
  action :install
end

To

package 'git' do
  action :install
end

Upvotes: 0

Related Questions