Bug #10592
closedSnippets do not appear to work in "PXELinux global default" template
Description
I have working snippets in other PXELinux templates that work properly. If I include the snippet in PXELinux global default and click "Build PXE Default", the on-disk file does not change, and no error message is displayed.
I'm more than a little new to foreman, and I appear to fail at finding the appropriate logfile that shows a difference. If somebody can point me to the appropriate logfile, I'll be happy to include it.
- DETAILS ***
CentOS 6.6
[root@puppetmaster foreman-proxy]# rpm -q foreman ruby postgresql
foreman-1.8.0-1.el6.noarch
ruby-1.8.7.374-4.el6_6.x86_64
postgresql-8.4.20-2.el6_6.x86_64
[root@puppetmaster foreman-proxy]# uname -r
2.6.32-504.16.2.el6.x86_64
I have the following snippet configured:
<%# kind: snippet name: PXELinux memtest -%> MENU SEPARATOR LABEL memtest501 MENU LABEL Memtest86+ v5.01 KERNEL memtest/memtest86+-5.01
This snippet works in "PXELinux default local boot", however it does not work in "PXELinux global default". I did determine that it was not simply any code causing "PXELinux global default" to fail (after all the existing code for @profiles does't cause it to fail, but just to see if I could get it to throw any sort of error) by changing the template to the following:
BEFORE CODE <% if 1 == 1 -%> EQUAL <% else -%> NOT EQUAL <% end -%> AFTER CODE
After clicking "Build PXE Default", I had the expected data, "BEFORE CODE", "EQUAL", and "AFTER CODE" in /var/lib/tftpboot/pxelinux.cfg/default
However, if I copy "<%= snippet 'PXELinux memtest' %>" straight out of "PXELinux default local boot" (where it renders properly) and paste it into "PXELinux global default", even as the only content, clicking "Build PXE Default" does not change the existing pxelinux.cfg/default, and no error is presented in the web interface.
Here is what shows up in the log with the snippet:
Started GET "/config_templates/build_pxe_default" for XXX.XXX.XXX.XXX at 2015-05-22 10:39:43 -0500 2015-05-22 10:39:43 [I] Processing by ConfigTemplatesController#build_pxe_default as HTML 2015-05-22 10:39:43 [I] Redirected to https://puppetmaster.example.com/config_templates 2015-05-22 10:39:43 [I] Completed 302 Found in 29ms (ActiveRecord: 3.1ms) 2015-05-22 10:39:43 [I] Started GET "/config_templates" for XXX.XXX.XXX.XXX at 2015-05-22 10:39:43 -0500 2015-05-22 10:39:43 [I] Processing by ConfigTemplatesController#index as HTML 2015-05-22 10:39:43 [I] Rendered config_templates/index.html.erb within layouts/application (65.7ms) 2015-05-22 10:39:43 [I] Rendered common/_searchbar.html.erb (3.8ms) 2015-05-22 10:39:43 [I] Rendered home/_user_dropdown.html.erb (1.7ms) 2015-05-22 10:39:43 [I] Read fragment views/tabs_and_title_records-4 (209.3ms) 2015-05-22 10:39:43 [I] Rendered home/_topbar.html.erb (213.0ms) 2015-05-22 10:39:43 [I] Rendered layouts/base.html.erb (214.7ms) 2015-05-22 10:39:43 [I] Completed 200 OK in 296ms (Views: 284.7ms | ActiveRecord: 3.3ms)
Here is what shows up in the log without the snippet:
Started GET "/config_templates/build_pxe_default" for XXX.XXX.XXX.XXX at 2015-05-22 10:38:49 -0500 2015-05-22 10:38:49 [I] Processing by ConfigTemplatesController#build_pxe_default as HTML 2015-05-22 10:38:49 [I] Redirected to https://puppetmaster.example.com/config_templates 2015-05-22 10:38:49 [I] Completed 302 Found in 321ms (ActiveRecord: 4.4ms) 2015-05-22 10:38:49 [I] Started GET "/config_templates" for XXX.XXX.XXX.XXX at 2015-05-22 10:38:49 -0500 2015-05-22 10:38:49 [I] Processing by ConfigTemplatesController#index as HTML 2015-05-22 10:38:49 [I] Rendered config_templates/index.html.erb within layouts/application (70.6ms) 2015-05-22 10:38:49 [I] Rendered common/_searchbar.html.erb (4.1ms) 2015-05-22 10:38:49 [I] Rendered home/_user_dropdown.html.erb (1.6ms) 2015-05-22 10:38:49 [I] Read fragment views/tabs_and_title_records-4 (0.1ms) 2015-05-22 10:38:49 [I] Rendered home/_topbar.html.erb (2.6ms) 2015-05-22 10:38:49 [I] Rendered layouts/base.html.erb (4.3ms) 2015-05-22 10:38:49 [I] Completed 200 OK in 92ms (Views: 79.4ms | ActiveRecord: 3.6ms)
Tell me what to post and I'll happily do it. I've watched the database queries and can't see any meaningful difference, so either I'm just not looking in the right place, or it's not logging anything.
I can say that in /var/log/foreman-proxy/proxy.log (same host), the following entry appears:
<IP of foreman/pm> - - [22/May/2015 10:57:18] "POST /create_default HTTP/1.1" 200 - 0.0018
And it does not when there's a snippet in the global default template.
I have also disabled selinux and done the same without different results.