Push facts suceeded with Puppet, now fails

Problem:

We have a newly set up Foreman server. Yesterday after ironing out our cert issues, I got facts to upload to the server using Puppet, with sudo -u puppet /etc/puppetlabs/puppet/node.rb --push-facts. After this, current facts from all of our hosts were visible in the Foreman console. Great.

But today, the facts have not been updated. The puppet-agent service is running on all of the hosts, and I can run puppet agent --test on all of them successfully, but when I run sudo -u puppet /etc/puppetlabs/puppet/node.rb --push-facts on the Foreman server again, the facts are not updated – they still show the last update from yesterday, including facts that should have changed like uptime_seconds. There is no error shown on the console from the command.

But if I specify a host to update with sudo -u puppet /etc/puppetlabs/puppet/node.rb myhost.mydomain --push-facts, I get the error:

No such file or directory @ rb_file_s_size - /opt/puppetlabs/server/data/puppetserver/yaml/facts/myhost.mydomain.yaml

And indeed /opt/puppetlabs/server/data/puppetserver/yaml/facts is empty. Thinking the contents of that directory might somehow have been erased, I checked our backups, which showed that that directory has never contained any files.

If that’s the case, why did facts get pushed the first time? And more importantly, what do I need to do to get it working again?

Foreman and Proxy versions:

Foreman 3.11
Katello 4.13
Puppet server 7.17

Distribution and version:

Alma Linux 8.10

I have no idea why, but it’s working again after I ran foreman-installer on the Foreman server. /opt/puppetlabs/server/data/puppetserver/yaml/facts/ is still empty, but now pushing facts doesn’t complain about it, and facts are once again getting pushed.