Error with puppet on new foreman/katello install

Problem: I get this error when i restart puppet or do anything with the agent:

[root@cm ~]# /opt/puppetlabs/bin/puppet agent --test
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Facter: error while resolving custom facts in /opt/puppetlabs/puppet/cache/lib/facter/root_home.rb: /opt/puppetlabs/puppet/cache/lib/facter/root_home.rb:43: syntax error, unexpected '.'
    str&.split("\n")&.each do |line|
         ^
/opt/puppetlabs/puppet/cache/lib/facter/root_home.rb:43: syntax error, unexpected '.'
    str&.split("\n")&.each do |line|
                      ^
Info: Caching catalog for hostname.com
Info: Applying configuration version '1618845875'
Notice: Applied catalog in 0.15 seconds

Expected outcome:
Fix the error or understand it can be ignored

Foreman and Proxy versions:
foreman-proxy-1.20.3-1.el7.noarch
foreman-1.20.3-1.el7.noarch

Foreman and Proxy plugin versions:
how do i get this?

Distribution and version:
CentOS Linux release 7.9.2009 (Core)

Other relevant data:

A snip from root_home.rb including like 43:

Facter.add(:root_home) do
  confine kernel: :aix
  root_home = nil
  setcode do
    str = Facter::Util::Resolution.exec('lsuser -c -a home root')
    str&.split("\n")&.each do |line|
      next if %r{^#}.match?(line)
      root_home = line.split(%r{:})[1]
    end
    root_home
  end
end

This is a relatively new install. I have a few repos setup, 1 non-working test client. I used the below to install:

foreman-installer --scenario katello --foreman-admin-username “fadmin” --katello-proxy-port 3128 --katello-proxy-url http://x.x.x.x --foreman-proxy-bind-host ‘*’

I started to setup custom certs and noticed the error. I rolled back to before and still have the error.

Thank you for any help!

root_home.rb is a file from puppetlabs stdlib module. You seem to have a broken stdlib. Update the module on your puppetmaster.

I didn’t have puppetlabs-stdlib installed (nothing required it as a dependency). I just installed it and restarted services and still have the same error.

python-pulp-puppet-common-2.18.1-1.el7.noarch
hostname-puppet-client-1.0-1.noarch
pulp-puppet-tools-2.18.1-1.el7.noarch
puppet-agent-1.10.14-1.el7.x86_64
puppet-agent-oauth-0.5.1-3.el7.noarch
puppetserver-2.8.1-1.el7.noarch
puppetlabs-stdlib-4.25.1-1.el7.noarch
puppetlabs-release-pc1-1.1.0-5.el7.noarch
pulp-puppet-plugins-2.18.1-1.el7.noarch

here’s your problem. You’re on Puppet 4 which uses Ruby 2.1. That doesn’t support the safe navigator that was introduced in Ruby. IIRC in 2.4 so Puppet 5 should be safe. However, puppetlabs/stdlib 7 only declares compatibility with Puppet 6 or newer.

You should either downgrade the module or upgrade your Puppet. Given Puppet 4 is EOL (and so is Puppet 5 by now), I’d recommend upgrading. 4 to 5 (and 6) has been mostly painless in my experience.

1 Like

That makes sense! Thank you!

I was following a guide from a year ago https://www.linuxsysadmins.com/install-foreman-katello-patch-management-on-centos-7/

When i started my research at the beginning of the year some parts were not fully supported on centos8 yet. Hopefully everything is not supported and I can just reinstall with centos8 and try this setup all over again (with newer versions).

You should also use a supported Foreman version. Foreman 1.20 is old now. Currently 2.3 and 2.4 are supported with 2.5 release candidate is planned for next week.