Bug #6833
closedPXE default menu doesn't honour unattended_url setting
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1124386
Description of problem:
When usng the API to create a default PXE menu, from the server itself - the URL points at localhost
Version-Release number of selected component (if applicable):
How reproducible100%
Steps to Reproduce:
1. Log onto the Satellite via ssh
2. Call the API to set the Default PXE menu (curl -K /opt/hoici/etc/curl-hoici.conf -XGET --data-urlencode per_page=9999 https://localhost/api/v2/config_templates/build_pxe_default)
3. cat /var/lib/tftpboot/pxelinux.cfg/default
Actual results:
DEFAULT menu
PROMPT 0
MENU TITLE PXE Menu
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT 0
LABEL HOI-6.5.0-ci-Library - crash/IPS-Satellite6
kernel boot/RedHat-6.5-x86_64-vmlinuz
append initrd=boot/RedHat-6.5-x86_64-initrd.img ks=https://localhost/unattended/template/HOI-6.5.0-ci-Library/IPS-Satellite6 ksdevice=bootif network kssendmac
ipappend 2
Expected results:
The kickstart should contain the hostname of the tftp capsule
Additional info:
Below is a posible fix copied from the host_template_helpers.rb
/usr/share/foreman/app/controllers/api/v2/config_templates_controller.rb line 90
def default_template_url template, hostgroup
# Get basic stuff
config = URI.parse(Setting[:unattended_url])
protocol = config.scheme || 'http'
port = config.port || request.port
host = config.host || request.host
url_for :only_path => false, :action => :template, :controller => '/unattended',
:protocol => protocol, :host => host, :port => port,
:id => template.name, :hostgroup => hostgroup.name
End