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 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
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
lzap
June 18, 2021, 7:34am
11
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!
mcorr
June 18, 2021, 8:49am
12
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
1 Like
Polle
September 20, 2024, 6:56am
13
Running Foreman 3.10 - Katello 4.12.1 -getting a similar problem again:
2024-09-19T18:13:50 [W|app|6a5387ff] Error rendering the Preseed default finish template
2024-09-19T18:13:50 [I|app|6a5387ff] Backtrace for ‘Error rendering the Preseed default finish template’ error (Foreman::Exception): ERF42-7327 [Foreman::Exception]: The snippet ‘Preseed default finish custom snippet’ threw an error: Safemode doesn’t allow to access ‘katello_agent_enabled?’ on #Safemode::ScopeObject
** 6a5387ff | /usr/share/gems/gems/safemode-1.4.0/lib/safemode/scope.rb:39:in method_missing'** ** 6a5387ff | Preseed default finish custom snippet:75:in
initialize’**
** 6a5387ff | /usr/share/gems/gems/safemode-1.4.0/lib/safemode.rb:52:in eval'** ** 6a5387ff | /usr/share/gems/gems/safemode-1.4.0/lib/safemode.rb:52:in
eval’**
** 6a5387ff | /usr/share/foreman/app/services/foreman/renderer/safe_mode_renderer.rb:7:in render'** ** 6a5387ff | /usr/share/foreman/app/services/foreman/renderer/base_renderer.rb:18:in
render’**
** 6a5387ff | /usr/share/foreman/app/models/template.rb:172:in render'** ** 6a5387ff | /usr/share/foreman/app/services/foreman/renderer/scope/macros/snippet_rendering.rb:60:in
snippet’**
** 6a5387ff | /usr/share/foreman/app/services/foreman/renderer/scope/macros/snippet_rendering.rb:25:in snippet_if_exists'** ** 6a5387ff | /usr/share/gems/gems/safemode-1.4.0/lib/safemode/scope.rb:37:in
method_missing’**
** 6a5387ff | Preseed default finish:104:in initialize'** ** 6a5387ff | /usr/share/gems/gems/safemode-1.4.0/lib/safemode.rb:52:in
eval’**
** 6a5387ff | /usr/share/gems/gems/safemode-1.4.0/lib/safemode.rb:52:in eval'** ** 6a5387ff | /usr/share/foreman/app/services/foreman/renderer/safe_mode_renderer.rb:7:in
render’**
** 6a5387ff | /usr/share/foreman/app/services/foreman/renderer/base_renderer.rb:18:in render'** ** 6a5387ff | /usr/share/foreman/app/services/foreman/renderer.rb:46:in
render’**
** 6a5387ff | /usr/share/foreman/app/models/template.rb:172:in render'** ** 6a5387ff | /usr/share/foreman/app/controllers/concerns/foreman/controller/template_rendering.rb:18:in
safe_render’**
** 6a5387ff | /usr/share/foreman/app/controllers/concerns/foreman/controller/template_rendering.rb:9:in render_template'** ** 6a5387ff | /usr/share/foreman/app/controllers/unattended_controller.rb:128:in
render_provisioning_template’**
** 6a5387ff | /usr/share/foreman/app/controllers/unattended_controller.rb:68:in host_template'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/basic_implicit_render.rb:6:in
send_action’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/base.rb:228:in process_action'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/rendering.rb:30:in
process_action’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/callbacks.rb:42:in block in process_action'** ** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:117:in
block in run_callbacks’**
** 6a5387ff | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in set_timezone'** ** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in
block in run_callbacks’**
** 6a5387ff | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in clear_thread'** ** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in
block in run_callbacks’**
** 6a5387ff | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in set_topbar_sweeper_controller'** ** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in
block in run_callbacks’**
** 6a5387ff | /usr/share/gems/gems/audited-5.4.3/lib/audited/sweeper.rb:16:in around'** ** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in
block in run_callbacks’**
** 6a5387ff | /usr/share/gems/gems/audited-5.4.3/lib/audited/sweeper.rb:16:in around'** ** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in
block in run_callbacks’**
** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:137:in run_callbacks'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/callbacks.rb:41:in
process_action’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/rescue.rb:22:in process_action'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/instrumentation.rb:34:in
block in process_action’**
** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications.rb:203:in block in instrument'** ** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications/instrumenter.rb:24:in
instrument’**
** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications.rb:203:in instrument'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/instrumentation.rb:33:in
process_action’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/params_wrapper.rb:249:in process_action'** ** 6a5387ff | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/railties/controller_runtime.rb:27:in
process_action’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/base.rb:165:in process'** ** 6a5387ff | /usr/share/gems/gems/actionview-6.1.7.8/lib/action_view/rendering.rb:39:in
process’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal.rb:190:in dispatch'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal.rb:254:in
dispatch’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:50:in dispatch'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:33:in
serve’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:50:in block in serve'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:32:in
each’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:32:in serve'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:842:in
call’**
** 6a5387ff | /usr/share/gems/gems/katello-4.12.1/lib/katello/middleware/organization_created_enforcer.rb:18:in call'** ** 6a5387ff | /usr/share/gems/gems/katello-4.12.1/lib/katello/middleware/event_daemon.rb:10:in
call’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in call'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in
call’**
** 6a5387ff | /usr/share/gems/gems/apipie-dsl-2.6.2/lib/apipie_dsl/static_dispatcher.rb:67:in call'** ** 6a5387ff | /usr/share/gems/gems/apipie-rails-1.3.0/lib/apipie/static_dispatcher.rb:74:in
call’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in call'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in
call’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in call'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in
call’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in call'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in
call’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in call'** ** 6a5387ff | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in
call’**
** 6a5387ff | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in call'** ** 6a5387ff | /usr/share/gems/gems/apipie-rails-1.3.0/lib/apipie/middleware/checksum_in_headers.rb:27:in
call’**
** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/tempfile_reaper.rb:15:in call'** ** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/etag.rb:27:in
call’**
** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/conditional_get.rb:27:in call'** ** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/head.rb:12:in
call’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/http/permissions_policy.rb:22:in call'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/http/content_security_policy.rb:19:in
call’**
** 6a5387ff | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in call'** ** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/session/abstract/id.rb:266:in
context’**
** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/session/abstract/id.rb:260:in call'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/cookies.rb:697:in
call’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/callbacks.rb:27:in block in call'** ** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:98:in
run_callbacks’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/callbacks.rb:26:in call'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in
call’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/debug_exceptions.rb:29:in call'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/show_exceptions.rb:33:in
call’**
** 6a5387ff | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/rack/logger.rb:37:in call_app'** ** 6a5387ff | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/rack/logger.rb:28:in
call’**
** 6a5387ff | /usr/share/gems/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in call'** ** 6a5387ff | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in
call’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/remote_ip.rb:81:in call'** ** 6a5387ff | /usr/share/gems/gems/request_store-1.6.0/lib/request_store/middleware.rb:19:in
call’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/request_id.rb:26:in call'** ** 6a5387ff | /usr/share/gems/gems/katello-4.12.1/lib/katello/prevent_json_parsing.rb:12:in
call’**
** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/method_override.rb:24:in call'** ** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/runtime.rb:22:in
call’**
** 6a5387ff | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in call'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/executor.rb:14:in
call’**
** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/sendfile.rb:110:in call'** ** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/ssl.rb:83:in
call’**
** 6a5387ff | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/host_authorization.rb:142:in call'** ** 6a5387ff | /usr/share/gems/gems/secure_headers-6.5.0/lib/secure_headers/middleware.rb:11:in
call’**
** 6a5387ff | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/engine.rb:539:in call'** ** 6a5387ff | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/railtie.rb:207:in
public_send’**
** 6a5387ff | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/railtie.rb:207:in method_missing'** ** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/urlmap.rb:74:in
block in call’**
** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/urlmap.rb:58:in each'** ** 6a5387ff | /usr/share/gems/gems/rack-2.2.8/lib/rack/urlmap.rb:58:in
call’**
** 6a5387ff | /usr/share/gems/gems/puma-6.4.2/lib/puma/configuration.rb:272:in call'** ** 6a5387ff | /usr/share/gems/gems/puma-6.4.2/lib/puma/request.rb:100:in
block in handle_request’**
** 6a5387ff | /usr/share/gems/gems/puma-6.4.2/lib/puma/thread_pool.rb:378:in with_force_shutdown'** ** 6a5387ff | /usr/share/gems/gems/puma-6.4.2/lib/puma/request.rb:99:in
handle_request’**
** 6a5387ff | /usr/share/gems/gems/puma-6.4.2/lib/puma/server.rb:464:in process_client'** ** 6a5387ff | /usr/share/gems/gems/puma-6.4.2/lib/puma/server.rb:245:in
block in run’**
** 6a5387ff | /usr/share/gems/gems/puma-6.4.2/lib/puma/thread_pool.rb:155:in block in spawn_thread'** ** 6a5387ff | /usr/share/gems/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in
block in create_with_logging_context’**
2024-09-19T18:13:50 [E|app|6a5387ff] There was an error rendering the Preseed default finish template: ERF42-7327 [Foreman::Exception]: The snippet ‘Preseed default finish custom snippet’ threw an error: Safemode doesn’t allow to access ‘katello_agent_enabled?’ on #Safemode::ScopeObject
2024-09-19T18:13:50 [I|app|6a5387ff] Rendered text template (Duration: 0.0ms | Allocations: 1)
2024-09-19T18:13:50 [I|app|6a5387ff] Completed 500 Internal Server Error in 115ms (Views: 0.6ms | ActiveRecord: 26.7ms | Allocations: 79574)
Polle
September 20, 2024, 7:23am
14
Polle:
cust
argh … seems to be located in my custom finish script - missed that while reading …