Bug 1124386

Summary: PXE default menu doesn't honour unattended_url setting
Product: Red Hat Satellite Reporter: Ade Bradshaw <abradshaw>
Component: ProvisioningAssignee: Stephen Benjamin <stbenjam>
Status: CLOSED ERRATA QA Contact: Kedar Bidarkar <kbidarka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.3CC: abradshaw, bbuckingham, bkearney, cwelton, kbidarka, peter.vreman, stbenjam, tkolhar
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/4463
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 05:11:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1136002    
Bug Blocks: 1122832    

Description Ade Bradshaw 2014-07-29 11:57:32 UTC
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

Comment 1 RHEL Program Management 2014-07-29 12:03:50 UTC
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.

Comment 3 Dominic Cleal 2014-07-30 09:39:28 UTC
Created redmine issue http://projects.theforeman.org/issues/6833 from this bug

Comment 4 Dominic Cleal 2014-07-30 09:41:31 UTC
Connecting redmine issue http://projects.theforeman.org/issues/4463 from this bug

Comment 5 Dominic Cleal 2014-09-19 15:50:41 UTC
*** Bug 1144322 has been marked as a duplicate of this bug. ***

Comment 6 Bryan Kearney 2014-10-31 12:03:47 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/4463 has been closed
-------------
Anonymous
Applied in changeset commit:0e3d065853992a67ab35f3d0a2747d36a766ab24.

Comment 7 Bryan Kearney 2015-01-09 14:49:10 UTC
Upstream bug assigned to stbenjam

Comment 10 Tazim Kolhar 2015-04-01 12:04:47 UTC
please provide verification steps
thanks

Comment 11 Stephen Benjamin 2015-04-09 09:54:00 UTC
The steps to reproduce are in comment #1

Comment 12 Tazim Kolhar 2015-04-13 11:14:46 UTC
VERIFIED:

# rpm -qa | grep foreman
foreman-postgresql-1.7.2.15-1.el6_6sat.noarch
foreman-ovirt-1.7.2.15-1.el6_6sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.3-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.5-1.el6_6sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el6_6sat.noarch
ruby193-rubygem-foreman-redhat_access-0.1.0-1.el6_6sat.noarch
rubygem-hammer_cli_foreman-0.1.4.7-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.3-1.el6_6sat.noarch
foreman-1.7.2.15-1.el6_6sat.noarch
foreman-gce-1.7.2.15-1.el6_6sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.10-1.el6_6sat.noarch
foreman-debug-1.7.2.15-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.4-1.el6_6sat.noarch
foreman-selinux-1.7.2.13-1.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-1.0-2.noarch
foreman-compute-1.7.2.15-1.el6_6sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.7-1.el6_6sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.9-1.el6_6sat.noarch
foreman-libvirt-1.7.2.15-1.el6_6sat.noarch
foreman-proxy-1.7.2.4-1.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-client-1.0-1.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-client-1.0-1.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el6_6sat.noarch
foreman-vmware-1.7.2.15-1.el6_6sat.noarch


# curl -k -u admin -XGET https://qe-sat6-rhel66.usersys.redhat.com/api/v2/config_templates/build_pxe_default
Enter host password for user 'admin':
PXE Default file has been deployed to all Smart Proxies

cat /var/lib/tftpboot/pxelinux.cfg/default


DEFAULT menu
PROMPT 0
MENU TITLE PXE Menu
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local

LABEL local
     MENU LABEL (local)
     MENU DEFAULT
     LOCALBOOT 0

Comment 13 Peter Vreman 2015-04-13 11:56:47 UTC
Sorry, but the used QA test is not incorrect to verify the expected behaviour:
- It doesn't use localhost in the curl GET command
- There is no hostgroup menu entry to verify that the unattended_url is really used

Comment 14 Kedar Bidarkar 2015-04-14 12:47:52 UTC
Reopening as this bug needs to be verified properly, as per the initial bug description.

Comment 15 Kedar Bidarkar 2015-04-21 08:21:32 UTC
[root@xxxx pxelinux.cfg]# curl -k -u admin -XGET --data-urlencode per_page=9999 https://localhost/api/v2/config_templates/build_pxe_default
Enter host password for user 'admin':
PXE Default file has been deployed to all Smart Proxies[root@dhcp201-174 pxelinux.cfg]# ls
default
[root@dhcp201-174 pxelinux.cfg]# cat default 




DEFAULT menu
PROMPT 0
MENU TITLE PXE Menu
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local

LABEL local
     MENU LABEL (local)
     MENU DEFAULT
     LOCALBOOT 0

LABEL Satellite Kickstart Default - rhel66_grp
     kernel boot/RedHat-6.6-x86_64-vmlinuz
     append initrd=boot/RedHat-6.6-x86_64-initrd.img ks=https://http://dhcpxxx-yy.englabit.pune.redhat.com/unattended/template/Satellite%20Kickstart%20Default/rhel66_grp ksdevice=bootif network kssendmac



But I feel this bug better be re-tested after bug https://bugzilla.redhat.com/show_bug.cgi?id=1136002 is fixed.

Comment 16 Kedar Bidarkar 2015-05-04 17:46:34 UTC
[root@xyz pxelinux.cfg]# curl -k -u admin -XGET --data-urlencode per_page=9999 https://localhost/api/v2/config_templates/build_pxe_default
Enter host password for user 'admin':
PXE Default file has been deployed to all Smart Proxies
[root@xyz pxelinux.cfg]# ls
 default
[root@xyz pxelinux.cfg]# cat default 
DEFAULT menu
PROMPT 0
MENU TITLE PXE Menu
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local

LABEL local
     MENU LABEL (local)
     MENU DEFAULT
     LOCALBOOT 0

LABEL Satellite Kickstart Default - rhel66_grp
     kernel boot/RedHat-6.6-x86_64-vmlinuz
     append initrd=boot/RedHat-6.6-x86_64-initrd.img ks=http://xyzabc.englabit1.pune1.redhat.com:80/unattended/template/Satellite%20Kickstart%20Default/rhel66_grp ksdevice=bootif network kssendmac


VERIFIED with Satellite-6.1.0-RHEL-7-20150429.2/satellite-6.1-GA-SNAP2

Comment 17 Bryan Kearney 2015-08-11 13:28:07 UTC
This bug is slated to be released with Satellite 6.1.

Comment 18 errata-xmlrpc 2015-08-12 05:11:57 UTC
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