Problem:
I upgraded our Foreman dev instance from 1.16/Katello 3.5 to 1.20/3.9. Since then out ptables do not render anymore. The Templates use snippets, but I get the error that “The specified snippet ‘<ptable_snippet_name>’ does not exist, or is not a snippet.” I doublecked that all Information is correct and that the correct org/loc are assigned but cannot find any errors. Creating a new ptable with a new snippet works just fine though.
Expected outcome:
Our preexisting ptables render and the snippets are found.
Foreman and Proxy versions:
Foreman 1.20.1
Proxy: 1.20.1
Foreman and Proxy plugin versions:
tfm-rubygem-hammer_cli_foreman_tasks-0.0.13-1.fm1_20.el7.noarch
foreman-postgresql-1.20.1-1.el7.noarch
foreman-installer-katello-3.9.1-1.el7.noarch
foreman-cli-1.20.1-1.el7.noarch
foreman-installer-1.20.1-1.el7.noarch
tfm-rubygem-foreman_bootdisk-14.0.0-1.fm1_20.el7.noarch
foreman-selinux-1.20.1-1.el7.noarch
foreman-vmware-1.20.1-1.el7.noarch
foreman-debug-1.20.1-1.el7.noarch
tfm-rubygem-foreman-tasks-0.14.3-1.fm1_20.el7.noarch
rubygem-foreman_maintain-0.3.0-1.el7.noarch
tfm-rubygem-foreman_hooks-0.3.15-1.fm1_20.el7.noarch
foreman-release-scl-7-2.el7.noarch
tfm-rubygem-foreman-tasks-core-0.2.5-2.fm1_20.el7.noarch
foreman-1.20.1-1.el7.noarch
tfm-rubygem-foreman_discovery-14.0.0-1.fm1_20.el7.noarch
tfm-rubygem-hammer_cli_foreman_docker-0.0.4-4.el7.noarch
tfm-rubygem-foreman_docker-4.1.0-2.fm1_20.el7.noarch
tfm-rubygem-foreman_remote_execution-1.6.7-1.fm1_20.el7.noarch
tfm-rubygem-hammer_cli_foreman-0.15.1-1.el7.noarch
foreman-compute-1.20.1-1.el7.noarch
foreman-proxy-1.20.1-1.el7.noarch
tfm-rubygem-foreman_scc_manager-1.4.0-3.fm1_20.el7.noarch
tfm-rubygem-foreman_remote_execution_core-1.1.4-1.el7.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3-7.el7.noarch
tfm-rubygem-foreman_templates-6.0.3-2.fm1_20.el7.noarch
foreman-release-1.20.1-1.el7.noarch
tfm-rubygem-foreman_snapshot_management-1.5.0-3.fm1_20.el7.noarch
Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)
Stacktrace production.log:
[W|app|c3d06] There was an error rendering the <kickstart template name> template:
RuntimeError: The specified snippet '<ptable_snippet_name>' does not exist, or is not a snippet.
/usr/share/foreman/lib/foreman/renderer/scope/macros/snippet_rendering.rb:18:in `snippet'
<ptable name>:4:in `get_binding'
/opt/rh/rh-ruby25/root/usr/share/ruby/erb.rb:885:in `eval'
/opt/rh/rh-ruby25/root/usr/share/ruby/erb.rb:885:in `result'
/usr/share/foreman/lib/foreman/renderer/unsafe_mode_renderer.rb:7:in `render'
/usr/share/foreman/lib/foreman/renderer/base_renderer.rb:16:in `render'
/usr/share/foreman/lib/foreman/renderer.rb:47:in `render'
/usr/share/foreman/app/models/host/managed.rb:357:in `diskLayout'
<kickstart template name>:87:in `get_binding'
/opt/rh/rh-ruby25/root/usr/share/ruby/erb.rb:885:in `eval'
/opt/rh/rh-ruby25/root/usr/share/ruby/erb.rb:885:in `result'
/usr/share/foreman/lib/foreman/renderer/unsafe_mode_renderer.rb:7:in `render'
/usr/share/foreman/lib/foreman/renderer/base_renderer.rb:16:in `render'
/usr/share/foreman/lib/foreman/renderer.rb:47:in `render'
/usr/share/foreman/app/models/template.rb:173:in `render'
/usr/share/foreman/app/controllers/unattended_controller.rb:193:in `safe_render'
/usr/share/foreman/app/controllers/unattended_controller.rb:114:in `render_template'
/usr/share/foreman/app/controllers/unattended_controller.rb:65:in `host_template'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:136:in `run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in `process'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/rendering.rb:32:in `process'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal.rb:191:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal.rb:252:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/lib/apipie/static_dispatcher.rb:65:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/lib/apipie/extractor/recorder.rb:137:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/usr/share/foreman/lib/middleware/telemetry.rb:9:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
/usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/tempfile_reaper.rb:15:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/etag.rb:25:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/conditional_get.rb:25:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/head.rb:12:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/usr/share/foreman/lib/middleware/logging_context.rb:23:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:232:in `context'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:226:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/cookies.rb:670:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/rack/logger.rb:28:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.9.1/lib/katello/prevent_json_parsing.rb:12:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/method_override.rb:22:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/runtime.rb:22:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-6.0.0/lib/secure_headers/middleware.rb:13:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/engine.rb:524:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `public_send'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `method_missing'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:68:in `block in call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `call'
/usr/share/passenger/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
/usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
/usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
/usr/share/passenger/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads'
/opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
ptable template:
<%#
WARNING: Template wird in git verwaltet, Änderungen werden in foreman überschrieben
kind: ptable
name: <name>
oses:
- CentOS 5
- CentOS 6
- CentOS 7
- Fedora 16
- Fedora 17
- Fedora 18
- Fedora 19
- Fedora 20
- RedHat 5
- RedHat 6
- RedHat 7
%>
#Dynamic - this line tells Foreman this is a script rather then a static layout
<%= snippet '<ptable_snippet_name' %>
ptable snippet:
<%#
WARNUNG: Template wird in git verwaltet, Änderungen werden in foreman überschrieben
kind: ptable
snippet: true
name: <ptable_snippet_name>
%>
<%
noexec_string = host_param_true?('tmp-exec') ? '' : 'noexec,'
nosuid_string = host_param_true?('tmp-suid') ? '' : 'nosuid,'
%>
if [ -e /dev/sdb ]; then
lsblk /dev/sdb | egrep 'lvm|part'
if [ $? -ne 0 ] ; then
PARTSDB=1
PARTDRIVES="sda,sdb"
else
PARTSDB=0
PARTDRIVES="sda"
fi
else
PARTDRIVES="sda"
fi
if [ -e /dev/sdc ]; then
DISKS=`lsblk -d|grep disk|grep -v fd0|awk '{print $1}'|sort|tail -n+3`
DISKLINE=`for disk in ${DISKS} ; do echo -n "${disk}," ; done | sed 's/,$//'`
echo "ignoredisk --drives=${DISKLINE}" > /tmp/diskpart.cfg
fi
cat <<EOF >> /tmp/diskpart.cfg
zerombr
clearpart --drives=${PARTDRIVES} --all --initlabel
part /boot --fstype=ext4 --size=750 --ondrive=sda
part pv.01 --size=1000 --grow --ondrive=sda
volgroup system pv.01
logvol /var --vgname=system --name=var --size=9728 --fstype=ext4
logvol /var/log/audit --vgname=system --name=var_log_audit --size=500 --fstype=ext4
logvol /tmp --vgname=system --name=tmp --size=<%= host_param('size_tmp') || '1024' %> --fsoptions=<%= noexec_string %><%= nosuid_string %>nodev --fstype=ext4
logvol swap --vgname=system --name=swap --size=2048
logvol / --vgname=system --name=root --size=1024 --grow --fstype=ext4
EOF
if [ -n "${PARTSDB}" ] ; then
if [ $PARTSDB -eq 1 ] ; then
cat <<EOF >> /tmp/diskpart.cfg
part pv.02 --ondrive=sdb --size=1000 --grow
volgroup data pv.02
logvol /var/log --vgname=data --name=var_log --size=1024 --fstype=ext4
logvol /var/crash --vgname=data --name=var_crash --size=4096 --fstype=ext4
logvol /home --vgname=data --name=home --size=1024 --fstype=ext4
logvol /opt/lhm --vgname=data --name=app --size=10 --fstype=ext4
EOF
else
cat <<EOF >> /tmp/diskpart.cfg
logvol /var/log --vgname=data --name=var_log --noformat
logvol /var/crash --vgname=data --name=var_crash --noformat
logvol /home --vgname=data --name=home --noformat
logvol /opt/lhm --vgname=data --name=app --noformat
EOF
fi
fi
I anonymized our template/snippet names, otherwise everything is unchanged.
Any help on where to look would be appreciated.