Red Hat Bugzilla – Bug 1098183
Using dots in kickstart template names or hostgroups causes routing errors
Last modified: 2016-07-27 07:00:58 EDT
Description of problem: Using dots in the names of kickstart templates or host groups results in problematic kickstart URLs in the default PXE configuration. Version-Release number of selected component (if applicable): 6.03 How reproducible: Always Steps to Reproduce: 1. Create a host group with a dot in the name 2. Create a kickstart with a dot in the name (NB we do not need dots in both the kickstart and host group name - either will cause a failure) 3. Associate the kickstart with the host group 4. Generate the PXE default menu by clicking the 'Build PXE Default' button 5. Go to /var/lib/tftpboot/pxelinux.cfg on the smartproxy and open the default file. 6. Paste the kickstart URL e.g. https://<servername>/foreman/unattended/template/testkickstart.1/test-1 into a browser window Actual results: A web message saying 'The page you were looking for doesn't exist'. In production.log, we see: ActionController::RoutingError (No route matches [GET] "/unattended/template/testkickstart.1/test-1"); Expected results: A rendered kickstart Additional info: This error occurs because the default Rails configuration uses dots as a separator for formatted routes, so doesn't accept them as part of dynamic segments. A few suggested workaround: 1. Permit the use of dots in segments for the unattended controller. 2. Add contstraints to the UI to reject any template names or host group names containing dots as illegal. 3. Transparently map dots to underscores in the application.
Since this issue was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release.
Created redmine issue http://projects.theforeman.org/issues/5826 from this bug
fixed https://github.com/theforeman/foreman/pull/1473
Moving to POST since upstream bug http://projects.theforeman.org/issues/5826 has been closed
1. Created a host group with a dot in the name [new.host] 2. Created a kickstart with a dot in the name [Satellite Kickstart Default for RHEL.v2] which has content same as "Satellite Kickstart Default for RHEL" 3. Associated the kickstart template with the host group, via "provision templates" -> <template name> -> Association -> "Add Combination". 4. Generated the PXE default menu by clicking the 'Build PXE Default' button 5. Moved to /var/lib/tftpboot/pxelinux.cfg on the smartproxy and opened the default file. 6. Tried accessing the link via the browser, https://dhcp201-170.englab.pnq.redhat.com/unattended/template/Satellite%20Kickstart%20Default%20for%20RHEL.v2/new.host But get the below messsage, "There was an error rendering the template: undefined method 'info' for Hostgroup::Jail (Hostgroup)" From the /var/log/foreman/production.log face the below issue. Completed 200 OK in 73ms (Views: 50.7ms | ActiveRecord: 4.9ms) Processing by UnattendedController#template as HTML Parameters: {"id"=>"Satellite Kickstart Default for RHEL.v2", "hostgroup"=>"new.host"} Rendered inline template (203.8ms) Rendered text template (0.0ms) Completed 500 Internal Server Error in 217ms (Views: 0.5ms | ActiveRecord: 1.5ms) ActionController::RoutingError (No route matches [GET] "/favicon.ico"): /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request' /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request' /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop' /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads' Processing by UnattendedController#template as HTML Parameters: {"id"=>"Satellite Kickstart Default for RHEL.v2", "hostgroup"=>"new.host"} Rendered inline template (45.6ms) Rendered text template (0.0ms) Completed 500 Internal Server Error in 55ms (Views: 0.6ms | ActiveRecord: 1.3ms) ActionController::RoutingError (No route matches [GET] "/favicon.ico"): /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request' /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request' /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop' /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'
That's a different bug, specifically with the template that's in use, it's not designed for host group-based provisioning.
Is this still a bug if the template is not designed for host group-based provisioning?
No needinfo required here, Joseph's question was answered in the redmine ticket.
Upstream bug assigned to stbenjam@redhat.com
Moving back to MODIFIED, since the code for this specific bug is already merged downstream, and removing me from the assignee, since I don't have anything to do with this bug. However, verifying this depends on a template enabled for host group provisioning. 1126087 provides one for Satellite. You'll need that to verify this.
Also putting the URL back to the original one, this BZ is not 6363, which isn't even needed in Satellite - Katello templates had a separate issue, which was handled in 1126087.
This Bug cannot be verified till Bug : 1126087 is verified. Tried with sat6.1 Beta snap6 compose2.
Currently host-group based provisioning templates cannot be rendered properly.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2015:1592
Accidentally closed with 6.1.1 errata
The described reproducer is blocked by BZ #1318732. If anyone can provide different reproducer we can proceed and verify this BZ.
Not really blocker, if we use chrome instead of firefox...
BLOCKED by BZ # 1220728 @Sat6.2.0-Beta Originally I wanted to FailQA but an error message is the same as with #BZ 1220728 FailedQA. # awk '/append/{print$3}' /var/lib/tftpboot/pxelinux.cfg/default ks=http://<SATFQDN>/unattended/template/Satellite%20Kickstart%20Default%20v2.0/RHEL7.2%20libvirt%20hosts # wget http://<SATFQDN>/unattended/template/Satellite%20Kickstart%20Default%20v2.0/RHEL7.2%20libvirt%20hosts production.log: 2016-05-05 10:54:35 [app] [I] Started GET "/unattended/template/Satellite%20Kickstart%20Default%20v2.0/RHEL7.2%20libvirt%20hosts" for 10.34.130.242 at 2016-05-05 10:54:35 -0400 2016-05-05 10:54:35 [app] [I] Processing by UnattendedController#hostgroup_template as HTML 2016-05-05 10:54:35 [app] [I] Parameters: {"id"=>"Satellite Kickstart Default v2.0", "hostgroup"=>"RHEL7.2 libvirt hosts"} 2016-05-05 10:54:35 [app] [W] Action failed | NoMethodError: undefined method `content_facet' for #<Hostgroup:0x007f5d272e78c8> | /opt/rh/rh-ror41/root/usr/share/gems/gems/activemodel-4.1.5/lib/active_model/attribute_methods.rb:435:in `method_missing'
VERIFIED. @satellite-6.2.0-14.2.el7sat.noarch foreman-1.11.0.34-1.el7sat.noarch Reproducer: 1. create Hostgroup "My.Hostgroup" and associate it to Satellite Kickstart Default 2. Build PXE Default 3. # cat /var/lib/tftpboot/pxelinux.cfg/default ... LABEL Satellite Kickstart Default - My.Hostgroup KERNEL boot/RedHat-6.8-x86_64-vmlinuz APPEND initrd=boot/RedHat-6.8-x86_64-initrd.img ks=http://<SATFQDN>/unattended/template/Satellite%20Kickstart%20Default/My.Hostgroup ksdevice=bootif network kssendmac 4. # curl http://<SATFQDN>/unattended/template/Satellite%20Kickstart%20Default/My.Hostgroup /var/log/foreman/production.log: 2016-06-06 06:25:02 [app] [I] Started GET "/unattended/template/Satellite%20Kickstart%20Default/My.Hostgroup" for <CLIENT_IP> at 2016-06-06 06:25:02 -0400 2016-06-06 06:25:02 [app] [I] Processing by UnattendedController#hostgroup_template as HTML 2016-06-06 06:25:02 [app] [I] Parameters: {"id"=>"Satellite Kickstart Default", "hostgroup"=>"My.Hostgroup"} 2016-06-06 06:25:02 [app] [I] Rendered inline template (71.7ms) 2016-06-06 06:25:02 [app] [W] There was an error rendering the Unnamed template: | ActionView::Template::Error: undefined method 'mac' for Hostgroup::Jail (Hostgroup) | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.2.3/lib/safemode/jail.rb:17:in `method_missing' | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.2.3/lib/safemode.rb:89:in `bind' >>> ActionController::RoutingError (No route matches [GET] "/unattended/template/...) is fixed, hitting another error reported later (BZ # 1126937)
The web message no longer says: "The page you were looking for doesn't exist" (as was reported in this bug) vs. Now it says: "There was an error rendering the Unnamed template: undefined method 'mac' for Hostgroup::Jail (Hostgroup)"
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2016:1501