Provisioning Template 500 Error

Problem: Provisioning template fails to download to machine due to 500 error on the server. Error text when browser preview is attempted:
There was an error rendering the Preseed default finish template: ERF42-7327 [Foreman::Exception]: The snippet 'puppet.conf' threw an error: undefined method '#present?' for Safemode::Jail (Environment)

Expected outcome: Preseed template can be downloaded by the machine or previewed in the browser (both return that error).

Foreman and Proxy versions: 2.5.0

Foreman and Proxy plugin versions: Also 2.5.0(?). I apologize if these are not the correct values

Distribution and version: Debian 10. Install attempted to both Debian 10 and Ubuntu 20.04 systems which result in the same outcome.

Other relevant data: I have not modified the puppet.conf file from what was installed by Foreman.

Thank you in advance for your help
-Adam

Could you please upload the whole traceback from production.log? That would tell us more probably. cc @ezr-ondrej just in case this is extraction related.

It is, it seems we’ve broken the template, because evironment doesn’t have present? allowed, as that is only available in 2.6 from Fixes #31370 - multi-host stub template snapshots (#8149) · theforeman/foreman@641c3f4 · GitHub. I’d guess we should just cherry-pick that part.

1 Like

If it is still needed, here is the complete log. I uploaded it to a paste site as it is quite long. hastebin

I’ve created Bug #32772: puppet.conf template do not render after introduction of puppet host params - Foreman to track this and filed PR with fix
Fixes #32772 - allow present? on ApplicationRecord by ezr-ondrej · Pull Request #8581 · theforeman/foreman · GitHub

If you could apply the https://github.com/theforeman/foreman/pull/8581.patch locally and let us know if that helped that would be great !

4 Likes

I came across the same error and the patch worked just fine.

3 Likes

Where/How do you patch this? I’m not familiar with the architecture, though we use (used) foreman to image 700 CentOS7 computers. Now we’re stuck since the latest update. I also don’t see 2.5.1 available in my repository to install.

Thanks.

2.5.1 is not out yet. It will still take a little bit of time till the release is done and you can install it.

This is roughly how you’d patch that locally:

cd /usr/share/foreman
patch -p0 <  https://github.com/theforeman/foreman/pull/8581.patch

Given it’s a small change you can even manually edit the file /usr/share/foreman/app/models/application_record.rb with contents of Fixes #32772 - allow present? on ApplicationRecord by ezr-ondrej · Pull Request #8581 · theforeman/foreman · GitHub

Don’t forget to restart the foreman server :slight_smile:

2 Likes

Thanks! I was able to modify the file and it’s working again. I have no clue how how those words made it work, but it’s amazing to see. Thank you. Is there a donation form for foreman? I might be able to get my company, SAIC, to throw a few dimes in. Many large DoD contractors are using foreman for Linux imaging (as cobbler no longer works for our use cases). I appreciate your help with this. We’re trying to get CentOS 7 pushed out 700+ workstations.

1 Like

We do not accept money donations, maybe this is something we can look into @mcorr ? If we choose to coninue not to, maybe a button that gets viewers to our sponsors page could do it.

Anyway, Foreman community is sponsored by several companies and users:

https://theforeman.org/sponsors.html

If you want to donate right now, what you can do is donating hardware resources (typically IaaS cloud instance(s)). Our tests are so slow (about an hour per each PR), we have just limited amount of worker nodes and thanks to our great sponsors we were able to stabilize a bit, but faster tests are huge help. It is indeed a commitment, a longer-term instance is what we want. Well, if you are interested, feel free to start a new topic here and our infra team will get back to you with details.

Thanks for considering that!

I think everything you’ve said is correct @lzap - we can’t accept money donations. There would be issues around conflicts of interest.

However if there was a donation of infrastructure etc, that would be perfectly acceptable.

I’m very happy that your problem is solved for now @cpmcmah - and a very warm welcome to the community :smiley:

1 Like